-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: AbortController is not defined on Node.js (Server Side Render) #3169
fix: AbortController is not defined on Node.js (Server Side Render) #3169
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this fixes anything, this module is not using strict mode so an undeclared global should not be a problem.
As I said on the issue, it's more likely a configuration problem: Uppy expects AbortController
to be available globally, leaving it as undefined
it's likely to cause problem down the road and create undefined behavior. A better workaround would be to make AbortController
and AbortSignal
available as globals on your env (either by using --experimental-abortcontroller
CLI flag, either by using polyfill).
I was wrong on this, the file that ends up on npm is using strict mode: https://unpkg.com/@uppy/[email protected]/lib/AbortController.js |
The issue I'm facing is that this code runs on node.js instead of the browser when it's used on SSR frameworks like Nuxt, Next.js, Gatsby.... The check of the typeof is the way SSR servers check if they are running on server or client and it works fine. This is not meant to run uppy on server side, instead it just allows it to be imported on the server code that will generate the HTMLs (on Server Side Rendered) that the client will use. |
hi @aduh95, what are the plans for this fix? |
Co-authored-by: Antoine du Hamel <[email protected]>
@aduh95 you can merge this if it's ready |
* main: Show all details on mobile when `showProgressDetails` is `true` (#3174) @uppt/xhr-upload: fix `this.uppy is undefined` error (#3207) ci: test on Node.js v16.x (#3205) @uppy/dashboard: fix linter (#3206) Add `2.1.1` to `CHANGELOG.md` Release Release Fix "attempted to use private field on non-instance" in `SearchProvider` (#3201) Add 'done' to `nb_NO.js` (#3200) @uppy/transloadit: fix unhandledPromiseRejection failures (#3197) fix: AbortController is not defined on Node.js (Server Side Render) (#3169)
closes #3168