-
Notifications
You must be signed in to change notification settings - Fork 255
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
NextJS/Authenticator error: "Missing getServerSnapshot, which is required for server-rendered content." #1780
Comments
I've narrowed this issue down to React v18. We're working on this issue now. In the meantime, the fix is to downgrade to React 17:
or, using yarn:
|
Nice, downgrading to React@17 fixed it for me. Thanks @slaymance! |
Hey @nickarocho and those who found this issue, we just merged a fix #1798 and will be in the next release. I'll let you know once it's released! |
Fixed in @aws-amplify/ui-react@2.15.8. |
this solved it for me, thanks! |
Before creating a new issue, please confirm:
On which framework/platform are you having an issue?
React
Which UI component?
Authenticator
How is your app built?
Create Next App
Please describe your bug.
When scaffolding a new Next.js app via
npx create-next-app
and trying to use theAuthenticator
component as documented, the app immediately breaks with a500
internal server error:What's the expected behaviour?
The Authenticator component should render without any error and the app should build properly with
yarn dev
.When the
Authenticator
is removed fromindex.js
the app renders as expected.Also, I tried both with/without wrapping
_app.js
withAuthenticator.Provider
and the error occurs in both approaches.I feel like I'm maybe doing something wrong with my setup but can't put my finger on it. The Amplify "Getting Started" docs for Next.js still uses
import { AmplifyAuthenticator } from '@aws-amplify/ui-react-v1'
, but I wanted to work on some use cases for the new Authenticator with Next and haven't found any relevant documentation on either the JS or UI docs site. I will update docs to use the new Authenticator component, but first want to make sure I am setting things up properly myself first.Thanks for the help!
Help us reproduce the bug!
npx create-next-app@latest next-example
cd next-example && code .
yarn add aws-amplify @aws-amplify/ui-react
amplify add auth
amplify push
amplify init
(default options)index.js
(snippet attached)yarn dev
Code Snippet
Additional information and screenshots
The text was updated successfully, but these errors were encountered: