muxinc / upchunk

Uploads Chunks! Takes big files, splits them up, then uploads each one with care (and PUT requests).
MIT License
336 stars 46 forks source link

_mux_upchunk__WEBPACK_IMPORTED_MODULE_8___default.a.createUpload is not a constructor #88

Closed AdamBCo closed 9 months ago

AdamBCo commented 2 years ago

I'm getting the following error when trying to create an upload:

_mux_upchunk__WEBPACK_IMPORTED_MODULE_8___default.a.createUpload is not a constructor

dylanjha commented 2 years ago

@AdamBCo can you share the code you're using to import upchunk?

danya3781 commented 2 years ago

I can confirm I was having the same issue. I was using typescript and was getting this error:

TypeError: _mux_upchunk__WEBPACK_IMPORTED_MODULE_2__.createUpload is not a function

Downgrading to upchunk version 2.3.1 fixed the issue for me.

AdamBCo commented 2 years ago

@dylanjha The code I was using is identical to what's posted in the example.

@danya3781 Your downgrade suggestion worked. Thank you 🙏🙏

gkatsev commented 2 years ago

What version of webpack are you using? Anything special in the configuration?

I'm going to assume that it likely broke with https://github.com/muxinc/upchunk/pull/84

wmdmark commented 2 years ago

We also experienced this same issue. We're on an older version of react-scripts (3.x) webpack (4.2.x).

Downgrading like @danya3781 suggested worked for now, but it would be nice to do that.

troyer commented 2 years ago

I'm having the same issue with Nuxt v2.15.8 TypeError: _mux_upchunk__WEBPACK_IMPORTED_MODULE_16__.createUpload is not a function

It happened to me with version 2.3.0, 2.3.1 and 2.6.0

gkatsev commented 2 years ago

hey, can someone post exactly how they're using UpChunk?

Locally, I tried the following and can get a not a function error in only one of the cases with upchunk 2.3.1 and 2.6.0 using webpack 5 and webpack 4:

import { createUpload } from '@mux/upchunk';
console.log(createUpload) // createUpload

import * as UpChunk from '@mux/upchunk';
console.log(UpChunk.createUpload) // createUpload

import { UpChunk, createUpload } from '@mux/upchunk';
console.log(UpChunk.createUpload) // nothing
console.log(createUpload) // createUpload
troyer commented 1 year ago

@gkatsev I tried all your ways and it all gave the same error.

gkatsev commented 1 year ago

@troyer are you able to make a small test case repo for me to reproduce? So far I've been unable 🙁

Wenxchn commented 1 year ago

Getting a similar issue with 2.6.0 and Webpack 4.44.2 _mux_upchunk__WEBPACK_IMPORTED_MODULE_10___default.a.createUpload is not a function

Update: The same issue persists with 2.3.1

Update 2: Was able to get it to work by downgrading to 2.5.0 but would be nice if this issue could be resolved.

nvahalik commented 1 year ago

Encountering the same issue.

We are trying to use it with Vue 2.x to no avail. Using web pack 4.x. I've tried the versions listed here, all to no avail.

gkatsev commented 1 year ago

Anyone able to set up a test project on codesandbox or a github repo that showcases this error? Unfortunately, in all my testing, I haven't been able to reproduce it.

nvahalik commented 1 year ago

The most frustrating part is that my build is successful.

It is only after the build, when you are trying to upload something, does it actually fail.

Workaround for now: just importing the script using <script src="https://unpkg.com/@mux/upchunk@2"></script>.

A demo sandbox would take me some time to put together...

andrewcmyk commented 1 year ago

In my environment, I had to change:

import * as UpChunk from '@mux/upchunk'

to

import * as UpChunk from '@mux/upchunk/dist/upchunk.mjs'
onyii5119 commented 1 year ago

UpChunk is throwing exception when I try to upload a video with a signed URL. I am using React 17.x and Upchunk 3.x

Uncaught (in promise) TypeError: _mux_upchunk__WEBPACK_IMPORTED_MODULE_23__.createUpload is not a function at ReviewVideoUpload.js:1719:1 (anonymous) @ ReviewVideoUpload.js:1719 await in (anonymous) (async) (anonymous) @ ReviewVideoUpload.js:1678 callCallback @ react-dom.development.js:3919 invokeGuardedCallbackDev @ react-dom.development.js:3968 invokeGuardedCallback @ react-dom.development.js:4028

Code Snippet:

console.log(">>>In uploadFiles(): muxSignedUrl is: ", muxSignedUrl);

if (file && !lodash.isEmpty(muxSignedUrl)) { const upload = UpChunk.createUpload({ endpoint: muxSignedUrl, file: file, chunkSize: 30720, // Uploads the file in ~30 MB chunks });

....... }

cjpillsbury commented 1 year ago

@onyii5119 if you could share a test project to reproduce your issue (a codesandbox, a simple public github repo, etc.), that would help us identify a root cause of your problem.

onyii5119 commented 1 year ago

import * as UpChunk from '@mux/upchunk/dist/upchunk.mjs' as suggested by @andrewcmyk resolved my issue.

onyii5119 commented 1 year ago

@onyii5119 if you could share a test project to reproduce your issue (a codesandbox, a simple public github repo, etc.), that would help us identify a root cause of your problem.

Thank you. My issue is resolved.

alex-fib commented 10 months ago

Seems to be an issue when using webpack 4 - I updated mine to be:

import { createUpload } from '@mux/upchunk/dist/upchunk';

As I was getting unit test & typescript issues when using

import * as UpChunk from '@mux/upchunk/dist/upchunk.mjs'
cjpillsbury commented 9 months ago

Hey Folks! We may have an improvement for some (maybe all? 🤞) of the build tools mentioned here. If anyone wants to give it a try, update to @mux/upchunk@3.3.0 and re-try doing your import like this:

import { createUpload } from '@mux/upchunk';

If you do try, let me know either way whether or not it works now.

dylanjha commented 9 months ago

Gonna close this as we confirmed the 3.3.0 fix in the tools that we were able to repro this in. If you're still experiencing this with your tooling please let us know. Thank you all for the reports along the way!