Skip to content

Kanopy videos don't load in the LMS app (Via breaks Kanopy's new JavaScript) #1760

Closed

Description

@mkdir-washington-edu

Kanopy videos don't load in the LMS app (Via breaks Kanopy's new JavaScript)

The issue

Kanopy video pages that previously displayed in the LMS app now show only Kanopy's logo and a loading spinner that never goes away. The same page loads normally outside Hypothesis. Note that there's no expectations to load an annotatble transcript; Kanopy doesn't have a public API. User's just show movies and have students create page notes.

Claude notes:

Observed (from three HAR captures — two through the LMS app, one loading Kanopy directly):

  • Kanopy has moved to a new frontend ("KUI"; response header kanopy-system: kui). The HTML page is an empty shell; the whole app is one ES module loaded via <script type="module" src=".../kui-assets/client-B_OO2n2q.js">. Removing the frontend=kui URL parameter makes no difference — Kanopy serves KUI either way.
  • Through Via, the bundle returns 200, but viahtml wraps it in its standard classic-script wombat wrapper ({ let window = ...; let arguments; { ...bundle... } }).
  • That wrapped file is not valid as a module. Checked with node --check, the file Via served fails twice over: first SyntaxError: Unexpected eval or arguments in strict mode (the wrapper's let arguments; — modules are always strict), then SyntaxError: Unexpected token 'export' (the bundle's final export{...} ends up inside the wrapper's block). The same file with the wrapper stripped parses cleanly.
  • Result: the app never runs. No Kanopy API calls and no lazy-loaded chunks appear in the Via HARs. Loaded directly, the same bundle loads ~40 chunks and calls /kapi/... endpoints within a second.
  • Kanopy is behind Cloudflare and serves its bot-detection script, but that check returns 200 through Via. Not a bot/IP block (unlike the PMC case).

Interpreted (not directly confirmed):

  • The error is the same one reported for the Canvas Studio public-embed workaround in Canvas Studio videos not working correctly when embedded in Canvas Pages and shown in the LMS app #1748 (Unexpected eval or arguments in strict mode right after Studio's main bundle loads). That error only fires in strict-mode code, so Studio's player is likely also an ES module hitting the same rewrite problem. Worth confirming in STUDIO2.har whether Studio's bundle is loaded with type="module".
  • pywb has separate handling for module scripts, but appears to detect them by looking for import/export at the start of a line. Kanopy's minified bundle has export{ mid-line, which may be why it was treated as a classic script. Not verified against the viahtml/pywb version we run.

What's needed

Sites that ship their main app as an ES module (Kanopy now; likely Canvas Studio's player) need to load and run through Via instead of failing at parse time.

Possible solution

Make viahtml rewrite ES-module scripts in a module-safe way (or leave them unwrapped), and make sure scripts loaded with type="module" are recognized as modules even when minified.

Claude notes:

Related: #1748 (Canvas Studio; the public-embed SyntaxError), #1749
HARs: [location]

Activity

  1. added
    lms
    on Oct 7, 2026
  2. mkdir-washington-edu commented on Oct 7, 2026

    @mkdir-washington-edu
    Author
  3. karenrasmussen commented on Nov 16, 2026

    @karenrasmussen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

lms

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions