-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
RuntimeConfigs in serverless mode #10395
Comments
Hi, I opened a PR addressing the runtime configs in dev mode although we don't recommend using document middleware as it's not something we plan to make stable/keep at this time and is why it's under an experimental flag |
Hi thanks for the changes regarding the development mode. The use case to be supported by the Document Middleware is that a translation capability can be introduced into an application. To do this, a variable must be set that identifies the root directory. If the file system is addressed in an application rolled out with Now, the root directory cannot be resolved. So the idea is to read the root directory in next.config.js and store it for the application via runtimeConfig. A ticket that deals with this problem is among others See here Document middleware in _document.js Configuration of next-i18next Unfortunately not working projectRoot: process.env.PROJECT_ROOT, idea use Use in next-i18next The critical thing is that process.cwd() is not the root folder when deployed with NOW. How do you think this can best be solved? |
It looks like the above middleware could be applied in |
Great catch, I will try that, thx! |
Using the middleware in getInitialProps had worked. I`m not using the document middleware anymore. Thx again! |
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. |
This issues continues findings from #10385
The following commits made runtimeConfigs in _document, _app etc available c01534c
My tests indicate that both variables (publicRuntimeConfig and serverRuntimeConfig a) are available in those components, but only in a production build.
In development mode runtimeConfigs are still undefined.
Also RuntimeConfigs are undefined in the document middleware.
The text was updated successfully, but these errors were encountered: