-
Notifications
You must be signed in to change notification settings - Fork 379
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
Angular 6 Failed to execute 'postMessage' on 'Worker' #249
Comments
I’m not sure why the error is looking like that for you. When I run your code (without the Angular bits), I get an error that what I am calling with - const worker = await new GenerateDataWokrer();
+ const worker = await new GenerateDataWokrer.GenerateData(); |
Hey I continue getting
Do you happen to have a working angular example with comlink? I have found only the one I've mentioned earlier. |
Can you host your code on a Glitch? This seems to be Angular-specific. |
I can't share my current project sadly. I will show the other project ( which will most probably work) in Glitch soon. I kind of wanted to understand what does the error mean so I know what I'm looking for as I debug. |
The error implies that the message payload contains an object with Function parameters and return values are part of the message, so that’s usually where the cause lies. From your example, you are only sending strings, so those should be fine. My guess is that Angular is injecting the symbol somewhere for some reason. But I am out of my depth there. |
Thank you for clarifying. I'm unable to reproduce the problem in a standalone project (it works there). I believe this is some underlying angular configuration on my side. Let's close the issue and I will respond when I find a solution. |
I encountered this same message ( Removing the debugger statement removes the symptom (it's sometimes replaced by a different error [with its own separable cause] that can make troubleshooting confusing). Searching the interwebs for that message leads to a Googlewhack on this ticket. Lacking any further evidence, I'm thinking Chrome devtools might be adding this symbol as an implicit flag, maybe as part of its "Scope" panel? Maybe this can help with reproduction. ... and now I got further evidence. In the case I have in hand right now:
the someMethod() being called was returning In the DOM thread, here's a stack trace goes with the error message.
^^^ ONLY when In the service worker, this error is thrown (either with or without
I checked to see whether the error at 250 was possibly being thrown from the worker, by adding logging in 2 catch() handlers in comlink.js. Nope. That leads me back to the devtools theory. I traded out someArg for Of course, removing |
Note: after fixing my real problem, the |
are you using Angular 6? for me it worked after migrating to 7. |
No, it's a React app, plain javascript through comlink for some share with >1 browser tabs. |
Hello, I've been trying to use this example to make comlinkjs work in Angular: https://medium.com/lacolaco-blog/enjoyable-webworkers-in-angular-41cfeb0e6519
(example is working when checked out: example
However I can't seem to replicate the example and I always get this error in my project
Here is my setup
calling it as:
Can you help me understand from where is the error coming from?
The text was updated successfully, but these errors were encountered: