react-social-login
react-social-login copied to clipboard
ReferenceError: window is not defined with Next.js during Server Side Rendering (SSR)
Hi
react-social-login has just recently updated to v3.4.16 and it has a problem during Server Side Rendering (SSR) with Next.js, because on the server side , window object is not defined , the below error can be seen on the shell during SSR:
In addition, I prettified the JavaScript codes of react-social-login located in this folder to know which line the error is :
- node_modules/react-social-login/dist/social-login.js
In line 8 window object is undefined
Please this is urgent for us, can you please fix it as soon as possible ?
- react-social-login : v3.4.16
- Next.js: v13.0.4
- Node.js v18
Same issue reproducing for me. Even tried the dynamic import for component with option {ssr: false} still getting this error.
- react-social-login: v3.4.16
- Next.js: v10.0.5
- Node.js: v11.15.0
Could you please revert to .15 version. I will look into this issue. If you have a fix, you can pull a request.
On Thu, Dec 1, 2022, 11:31 AM Aravin008 @.***> wrote:
Same issue reproducing for me. Even tried the dynamic import with option {ssr: false} still getting this error. Production build is also failing.
- react-social-login: v3.4.16
- Next.js: v10.0.5
- Node.js: v11.15.0
— Reply to this email directly, view it on GitHub https://github.com/deepakaggarwal7/react-social-login/issues/238#issuecomment-1333253192, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEU7A3BGRKLW3OHQ2UEZTGDWLA5K3ANCNFSM6AAAAAASPZQREY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Can you create a minimal failing example using next js on codesandbox or any other online tool (or attach a zip). It will help me replicate and fix it faster. Else, can you go through commit changes between .15 and .16 and suggest what could cause it. There isn't much change that has taken place
Could you please revert to .15 version. I will look into this issue. If you have a fix, you can pull a request. …
Thank you, yes I reverted back to version 3.4.15 and everything is fine now.
But also there was an error to revert back to this version, because the previous version does not support React 18, and I finally fix it by overriding peer dependency of react-social-login in package.json of our project and specified React v18.
Can you create a minimal failing example using next js on codesandbox or any other online tool (or attach a zip). It will help me replicate and fix it faster. Else, can you go through commit changes between .15 and .16 and suggest what could cause it. There isn't much change that has taken place
Yes I will do this , cheers :)
Any update on this? We have the same issue on Gatsby SSR, downgrading to v3.4.15 works for now.