-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Different getStaticPaths behavior with _app.js in development vs. production #16977
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
Comments
Thanks for the report! We'll take a look at the reproduction soon and ensure the behavior is consistent one way or the other. |
@Timer Thanks for the quick response! Let me know if I can help at all. That repro should help make this approachable. FYI, I was able to confirm that moving |
Shoot. I was preparing my talk for Next.js and did I'll be sure to call out that this bug is being addressed and to put If y'all are busy for these sprints, if you can point me to the tests/source that needs updating I can get it a PR started 🙏 |
Waiting for it! In my case when I execute
When the user executes the function signOut, the page is reloaded, then the /page/MySecretPage.tsx executes this method to validate if the user has access or not:
This is the function withAuth:
Right now I have the |
I'm having the same issue OS: macOS |
This seems to be solved in version |
@ericclemmons are you seeing ^ as well? |
Seems to work for me as well, I'm on 11.0.1 (with webpack4) and I can see my data being resolved on the server even though my Amplify app is hoisted only in |
@ericclemmons, unfortunately, the suggested workaround is not fixing the issue for me. I've included some details below:
It's also worth noting I've tried the following approaches in my
When I observe the Logger in my console, despite how I configure (or don't configure) the Auth module I get the same error:
I've also listed my Logger results relating to Auth -- let me know if you need additional detail from these logs, happy to provide.
It appears that the Auth category is being successfully configured, but for whatever reason, I'm unable to persist the user session from the previous page in order to query my API. I have my user object also stored in a context, but I'm unsure how calling this server-side might be done. The same issue was occurring on a Dashboard page that shows all games. Fortunately, I was able to move the API call to the client-side via Outside of using Please do let me know if I'm missing something in my implementation. Thanks! |
Still relevant for me, I'm on 11.1.2 with webpack 5 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Hi, this appears to be working consistently in the latest version of Next.js Screen.Recording.2022-02-24.at.11.42.01.AM.mp4 |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Describe the bug
In
_app.js
, I haveAmplify.configure(...)
that stores a configuration for internal use with other Amplify features (e.g.API
):However, when using
getStaticProps
for a page, I found that the instance ofAmplify
isn't configured when runningnext build
. It's as if_app.js
isn't imported or executed at all during the build!To Reproduce
Simple reproduction here: ericclemmons/next.js-issues-16977@bf9f827!
Notice how my static page
pages/[isConfigured].js
receives a value oftrue
indevelopment
(due to_app.js
setting the configuration) whilefalse
inproduction
(because_app.js
is presumably not called prior to executinggetStaticPaths
).👇 This is my "real-world" code from when I discovered this behavior. It shouldn't differ from the simpler reproduction above.
Expected behavior
I expected that, if a page extends
_app.js
, any effects that may have occurred within that file to persist in other pages during the build process.System information
The text was updated successfully, but these errors were encountered: