diff --git a/.changeset/dry-readers-itch.md b/.changeset/dry-readers-itch.md new file mode 100644 index 000000000..69b5600fe --- /dev/null +++ b/.changeset/dry-readers-itch.md @@ -0,0 +1,5 @@ +--- +"@uppy/tus": patch +--- + +Fix Node.js support by conditionally setting a property which does not exist in Node.js instead of crashing. diff --git a/packages/@uppy/tus/src/index.ts b/packages/@uppy/tus/src/index.ts index afd30f756..95cf1bb19 100644 --- a/packages/@uppy/tus/src/index.ts +++ b/packages/@uppy/tus/src/index.ts @@ -251,7 +251,9 @@ export default class Tus extends BasePlugin< uploadOptions.onBeforeRequest = async (req) => { const xhr = req.getUnderlyingObject() - xhr.withCredentials = !!opts.withCredentials + if (xhr) { + xhr.withCredentials = !!opts.withCredentials + } let userProvidedPromise: Promise | void if (typeof onBeforeRequest === 'function') {