Closed vastava closed 1 month ago
Hi @vastava,
A newer version, 0.10.15, is available. Could you please try using it and let us know if the issue persists?
Thank you!!
@kuaashish I upgraded to 0.10.15 and still facing the same issue
Ok after some investigation it seems likely the underlying issue is with the import of wasm library (similar issue opened in nextjs repo)
Could you provide guidance on best practices for handling WASM loading in Next.js? I'm dynamically importing the component and specified "use client" which should have disabled SSR, but still running into build issues.
Importing like this fixed it
const { FilesetResolver, ImageSegmenter } = await eval(`
import(
'https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.15/+esm'
)
`);
@kuaashish Hi! I am still facing the issue described here, is there any ideas on how to fix this ? Importing with eval
is hacky solution, which I cannot use in my circumstances. I tried tasks-vision 0.17 and 0.18-rc's
Interesting thing to note: the problem occurs only if an app is running on production server, locally everything is fine
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
Web Browser (Chrome)
MediaPipe Tasks SDK version
@mediapipe/tasks-vision@0.10.2
Task name (e.g. Image classification, Gesture recognition etc.)
Image Segmenter
Programming Language and version (e.g. C++, Python, Java)
Javascript
Describe the actual behavior
Error initializing ImageSegmenter in production, although it works locally.
Describe the expected behaviour
Successful initialization of ImageSegmenter and ability to perform image segmentation on webcam feed
Standalone code/steps you may have used to try to get what you need
Also, since this is a nextjs project, I'm dynamically importing the component like so:
Other info / Complete Logs
The ImageSegmentationComponent component I created works perfectly in local environment, but breaks in production. Specifically is not able to initialize ImageSegmenter class.
Also, interestingly, when I swap out the model for the FaceLandmarker model and change the params accordingly, the component works perfectly. I am not sure why this would be the case.
Here is the full error trace I see in the console (it is not very informative): TypeError: Super constructor null of nJ is not a constructor at new nJ (211.25927c0cdec0fb60.js:1:49860) at ie (211.25927c0cdec0fb60.js:1:17442) at tX.Ie [as aa] (211.25927c0cdec0fb60.js:1:22081) at tX.get (211.25927c0cdec0fb60.js:1:21885) at 211.25927c0cdec0fb60.js:1:21489 at tX.forEach ()
at tX.forEach (211.25927c0cdec0fb60.js:1:21459)
at 211.25927c0cdec0fb60.js:1:135863
at rB.J (211.25927c0cdec0fb60.js:1:135904)
at 211.25927c0cdec0fb60.js:1:57803
console. @ watchConsoleLogs.8258a5d6.js:6
overrideMethod @ react_devtools_backend_compact.js:13851
(anonymous) @ 893.99515cd9419e7cfc.js:1
await in (anonymous)
(anonymous) @ 893.99515cd9419e7cfc.js:1
Rj @ framework-0c7baedefba6b077.js:9
Ik @ framework-0c7baedefba6b077.js:9
(anonymous) @ framework-0c7baedefba6b077.js:9
Qk @ framework-0c7baedefba6b077.js:9
Fk @ framework-0c7baedefba6b077.js:9
jg @ framework-0c7baedefba6b077.js:9
(anonymous) @ framework-0c7baedefba6b077.js:9