-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Server-side rendering not supported in @aws-amplify/ui-components and @aws-amplify/ui-react #5293
Comments
Looking at a fix asap. Thanks for reporting |
@jordanranz I believe there are other places Web APIs are being used, such as |
Looks the like build failures are gone now using @aws-amplify/ui-react@unstable. @sawyerh can you verify? I will look into the |
@jordanranz Thank you, that does seem to fix the build in the test repo, so I believe this is resolved. I can open a separate issue if I rediscover where I was running into a |
Ok, I'll close this now as the root cause was fixed. It should also be released to |
I'm able to reproduce this. SSR is // src/components.ts
applyPolyfills().then(() => { defineCustomElements(window); }); You can see this here:
There is a PR to address this in a way, but it's not specific to SSR: I'm looking into how this can be addressed in the interim... |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems. |
Leaving this closed, as I've been able to confirm that There has also been a recent update that should get rid of the warning as well! |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Describe the bug
@aws-amplify/ui-components
and@aws-amplify/ui-react
reference web-only interfaces likewindow
anddocument
. This breaks React apps that utilizes server-side rendering, sincewindow
anddocument
are not defined in a Node.js environment.To Reproduce
Steps to reproduce the behavior:
README
document
andwindow
referencesExpected behavior
Code that calls web-only APIs should be conditional on the API being defined, for example:
Screenshots
Environment
Additional context
You can also observe #5282 using the same sample code, by removing the
next.config.js
file, which is in place to workaround that issue.Sample code
https://github.com/sawyerh/amplify-nextjs-ssr
The text was updated successfully, but these errors were encountered: