-
Notifications
You must be signed in to change notification settings - Fork 2
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
Window object not defined when accessing MyAlgo Wallet from Next.js SSR project #5
Comments
I should mention, I've opened this issue on the communication-bridge repo because the error I was thrown was coming from line 144 in the lib/messenger.js file when the |
Hi @daoarchitect the bridge is not intended to be used from a backend or server-side rendering. Can you give us some background on the project and why the code is loaded in the server side portion? |
Hey @mxmauro, looks like this was a Next.js-specific. I solved it by loading the component that was using the MyAlgo class dynamically using Next.js's Dynamic Import feature. |
Hello @scottbolasevich . Install the latest version of MyAlgo Connect. Import it normally, and instantiate the class inside an useEffect |
The window object is not defined when instantiating a new instance of the MyAlgo class, even if a
typeof window !== 'undefined'
check is done beforehand on the client side. I think all calls towindow
should be wrapped in a similar check in case the Communication Bridge is accessed from the server side.The text was updated successfully, but these errors were encountered: