Getting production issue! ReferenceError self is not defined


and when I copy the production JSON to my local setup and run it, it fails… Will send you passing and failing JSON

yes please

Old, passing JSON.txt

new, failing JSON.txt

when I am switching between these, OLD works 100%, and NEW generates the ‘self’ error

I can see self be referenced in the new code without being declared…

See image… these are the only two references of self in the new code. Old code does not have any references to self

smoking gun! :slightly_smiling_face:

yup been trying to hunt down where it came from :joy:

:pray:

hmm what’s your environment? you’re not using nextjs right

plain react

did a nextjs dependency creep in?

when you’re doing SSR, are you happen to be polyfilling your node environment to be more browser-like (defining window/window.document, etc)

don’t think so… window, document are not available during render

the ‘self’ enters the code before I render though… unless it is expected that it is available globally on the window, there is an error here…
… and if it is expected that it is available, then something has changed in requirements to run plasmic SSR

aha…

Are you trying to use ‘self’ on ‘window’?
Why not just call ‘fetch’ directly?

ahh I think I see what the issue is…

//BUG: As of 2022-03-26, plasmic puts web-rendered components in the pageData.bundle.modules.browser. When rendering on server-side these
//     need to be in *.server. Move the components over, but also make sure to not break if they fix this
pageData.bundle.modules.server = [...pageData.bundle.modules.server, ...pageData.bundle.modules.browser];

okay lemme think about this a bit… :thinking_face: