WixCode crashes

I’ve started a new site and added a few components to it. When I noticed $w.onReady didn’t run I opened the browser’s console to find this error:

Uncaught (in promise) TypeError: Cannot read property ‘SOME_ID’ of null
at createInitHandler.js:190
at Array.map ()
at createInitHandler.js:179
at worker.js:164
at n (wixcode-stores.js:1537)
at Generator._invoke (wixcode-stores.js:1766)
at Generator.e. [as next] (wixcode-stores.js:1589)
at asyncGeneratorStep (fetch.js:466)
at _next (worker.js:126)
at worker.js:126
at new Promise ()
at _processMessage (worker.js:126)
at worker.js:84
at queueUntilAllPrevIsProcessed.js:9
at Array.forEach ()
at queueUntilAllPrevIsProcessed.js:9
at Array.every ()
at o (queueUntilAllPrevIsProcessed.js:8)
at Object.handle (queueUntilAllPrevIsProcessed.js:40)
at worker.js:105
at self.onmessage (worker.js:92)

Searching for SOME_ID I’ve found it defined in an inline script:

var editorModel = {
    ...
    "applications": {
        "SOME_ID": {
            "controllersCount": ...
    ...
}

I’ve also tried to start a blank site and added dev tools to get the same effect so it’s not in my code.
In any case my code is:

$w.onReady(() => {
    console.log('ready');
});

ready is of course not printed.

Any way to fix or work around this?

EDIT:
This only happens in preview mode. Published site prints ‘ready’ and loads properly…

It works for me.

$w.onReady(() => {
    console.log('ready');
});

At moment there are a lot of users, which have problems with connections.
Take a look at the last few posts!

  • not working…

  • no connections…

  • no preview-mode

  • and so on…
    Perhaps a Wix-related issue?

I’m pretty sure it a WixCode issue because createInitHandler (which throws the unhandled error) is in wixcode-worker.js… Maybe a bug due to load on preview mode servers, but still a bug…

Yeah, very strange!

https://www.wix.com/corvid/forum/community-discussion/none-of-my-code-is-running-help

Hi,

This was related to the following issue that should be resolved by now. I’d suggest clearing your cache and test your code once again. If the issues persist, please contact the Wix Customer Care team for further assistance.

Best regards,
Miguel

Well done! Very fast reaction!:upside_down_face:

Apparently clearing the cache did the trick. Thanks!

all is ok for for me now, thx !