upchunk icon indicating copy to clipboard operation
upchunk copied to clipboard

_mux_upchunk__WEBPACK_IMPORTED_MODULE_8___default.a.createUpload is not a constructor

Open AdamBCo opened this issue 3 years ago • 9 comments

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

AdamBCo avatar Jul 14 '22 14:07 AdamBCo

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

dylanjha avatar Jul 14 '22 17:07 dylanjha

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.

danya3781 avatar Jul 17 '22 20:07 danya3781

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

@danya3781 Your downgrade suggestion worked. Thank you 🙏🙏

AdamBCo avatar Jul 18 '22 14:07 AdamBCo

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

gkatsev avatar Jul 18 '22 18:07 gkatsev

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.

wmdmark avatar Aug 11 '22 15:08 wmdmark

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

troyer avatar Aug 24 '22 16:08 troyer

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

gkatsev avatar Aug 24 '22 22:08 gkatsev

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

troyer avatar Sep 21 '22 11:09 troyer

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

gkatsev avatar Sep 21 '22 15:09 gkatsev

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.

Wenxchn avatar Oct 08 '22 21:10 Wenxchn

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.

nvahalik avatar Nov 21 '22 22:11 nvahalik

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.

gkatsev avatar Nov 21 '22 22:11 gkatsev

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...

nvahalik avatar Nov 21 '22 22:11 nvahalik

In my environment, I had to change:

import * as UpChunk from '@mux/upchunk'

to

import * as UpChunk from '@mux/upchunk/dist/upchunk.mjs'

andrewcmyk avatar Jan 31 '23 18:01 andrewcmyk

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 });

....... }

onyii5119 avatar Feb 13 '23 16:02 onyii5119

@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.

cjpillsbury avatar Feb 13 '23 22:02 cjpillsbury

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

onyii5119 avatar Feb 14 '23 02:02 onyii5119

@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.

onyii5119 avatar Feb 14 '23 02:02 onyii5119

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'

alex-fib avatar Oct 30 '23 15:10 alex-fib

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/[email protected] 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.

cjpillsbury avatar Nov 15 '23 23:11 cjpillsbury

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!

dylanjha avatar Nov 16 '23 00:11 dylanjha