Skip to content
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

Uncaught TypeError: self.postMessage - console errors #148

Open
themodernpk opened this issue Apr 25, 2020 · 6 comments
Open

Uncaught TypeError: self.postMessage - console errors #148

themodernpk opened this issue Apr 25, 2020 · 6 comments

Comments

@themodernpk
Copy link

Summary

Filepond keeps generating console errors like the following:

Uncaught TypeError: self.postMessage is not a function
    at sendMsg (app.js:162085)
    at Object.invalid (app.js:161498)
    at app.js:161803
    at SockJS.sock.onmessage (app.js:161415)
    at SockJS.EventTarget.dispatchEvent (app.js:108657)
    at app.js:109375
    at Array.forEach (<anonymous>)
    at SockJS._transportMessage (app.js:109373)
    at WebSocketTransport.EventEmitter.emit (app.js:108573)
    at WebSocketTransport.ws.onmessage (app.js:111449)

How to reproduce

Fairly simple usage of filepond:
https://gist.github.com/modernpk/16e61547332ed8eae016483caad63bf9

Expected behaviour

I am using hot reload, which is breaking because of these console errors. If I remove the filepond, everything seems working as expected.

Additional information

Environment Version
OS Windows 10
Browser Version 81.0.4044.122 (Official Build) (64-bit)
@rikschennink
Copy link
Collaborator

It sounds like a build script might be messing up the WebWorker functions.

These calls:

Screenshot 2020-04-27 at 08 51 48

Maybe there's a way to exclude FilePond and its plugins from this?

@themodernpk
Copy link
Author

@rikschennink I have no idea, do you?

@rikschennink
Copy link
Collaborator

@modernpk happy to take a look at a public test case

@themodernpk
Copy link
Author

@rikschennink thanks for your quick response. I fixed it by redefined self (using let keyword, e.g let self = this instead of self = this). It has nothing to do with filepond.

@themodernpk
Copy link
Author

@rikschennink I am facing the same issues again and I realized it is happening only when I run npm run hot (hot reload). So whenever I save the vue file and then it tries to reload the page that's when this error comes in the console and the page fails to reload.

@themodernpk themodernpk reopened this Dec 22, 2020
@rikschennink
Copy link
Collaborator

@themodernpk I honestly don't know why that would happen, I'm all ears. The WebWorkers are created dynamically so maybe the hot reload messes with references to these dynamic web workers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants