-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Static export publicRuntimeConfig
issues
#6249
Comments
I've found a solution that helped in another (albeit not completely related) thread: #4024 (comment)
with
I'm not really clear on why this error started happening after the update. Is this the intended way I'm supposed to access |
I think this is a bug. Could you do me a favor and create a minimal github repository so that we can reproduce it faster when we start working on a fix 🙏 |
Here is a repo with the issue. |
https://github.com/zeit/next.js/tree/canary/examples/with-universal-configuration-runtime Its also failing when I try to do an export using the one from the example, when I add an export step. |
Fixed in |
Thanks a lot for the fix! Any idea of when a |
Adding in a few more bugfixes. Most likely will do a new release today 👍 |
Awesome, thanks! 🙏 |
@bozskejkaja Your workaround would prevent errors, but I believe you will just have |
@NathanielHill You're absolutely right, it's definitely not an actual solution to the issue. In my case, it was a sufficient workaround since I'm not really using the env variables after statically exporting the app. Luckily, it looks like the issue is already resolved in 8.0.1 that just got released 🎉 |
It's released as 8.0.1 👍 |
Thanks again! 👌 |
Not working for me in Next v9 |
I'm facing the same issue in Next v9 when trying to update my
Any idea why? |
using Next v9 and this still works:
|
I found that if you need it working for static pages, you need it set at build time,
|
Hi, I can repro in v9.4:
In the log you'll see the full config correctly computed. But in I keep exploring the issue, I have a complete setup with TS and Webpack so I am not sure where the problem happens. Edit: I think I caught it, when the Quickfix is doing "publicRuntimeConfig || {}" when you get it but that's not intuitive. I can't find type definitions for |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Hi, after upgrading from v7.0.2. to v8.0.0., I've been having issues running static export. After running
next export
, I get an error:To be more specific, my publicRuntimeConfig in next.config.js is set up like this:
Tracking down the error, it seems to occur here:
There have been no changes except updating next.js from v7.0.2 to v8.0.0.
I've noticed in the v8 release blog summary that
"
publicRuntimeConfig
andserverRuntimeConfig
are not supported in theserverless
mode. Use build-time configuration instead.", so that got me thinking that maybe settingtarget
explicitly toserver
might help, but, alas, it did not.To Reproduce
publicRuntimeConfig
getConfig()
somewhere in the app & access thepublicRuntimeConfig
object that should be returnedExpected behavior
Static export should finish without any errors.
Screenshots
System information
The text was updated successfully, but these errors were encountered: