You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have this project structure, where I need to deploy one app from monorepo to Vercel, I created simpified reprocudction in GitHub repo.
The problem is with next-i18next.config.js and localePath. When I use path.resolve('./public/locales'), then the serverless function on Vercel can't find the locale files, when I use path.resolve('./packages/parent/public/locales'), then the pre-rendering function can't find the locale files, so there is this problem in recognizing if the config is in getStaticProps or getServerSideProps and I cant get it to work. Right now the config looks like this:
I tried to play with process.browser and typeof window === 'undefined' but that did not help.
When path.resolve('./public/locales') it crashes when trying to load SSR rendered page with error:
info - Loaded env from /var/task/.env
2021-11-29T13:47:12.977Z 0e7d42ba-aaae-4c84-bb41-96a5a3fb6847 ERROR Error: ENOENT: no such file or directory, scandir '/var/task/public/locales/en'
at Object.readdirSync (fs.js:1047:3)
at getLocaleNamespaces (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:175:23)
at /var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:181:20
at Array.map (<anonymous>)
at getNamespaces (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:180:44)
at createConfig (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:221:29)
at _callee$ (/var/task/node_modules/next-i18next/dist/commonjs/serverSideTranslations.js:199:53)
at tryCatch (/var/task/node_modules/regenerator-runtime/runtime.js:63:40)
at Generator.invoke [as _invoke] (/var/task/node_modules/regenerator-runtime/runtime.js:294:22)
at Generator.next (/var/task/node_modules/regenerator-runtime/runtime.js:119:21) {
errno: -2,
syscall: 'scandir',
path: '/var/task/public/locales/en',
page: '/'
}
RequestId: 0e7d42ba-aaae-4c84-bb41-96a5a3fb6847 Error: Runtime exited with error: exit status 1
Runtime.ExitError
When path.resolve('./package/parent/public/locales') it crashes during build with exit message:
Error occurred prerendering page "/en". Read more: https://nextjs.org/docs/messages/prerender-error
Error: ENOENT: no such file or directory, scandir '/vercel/path0/packages/parent/packages/parent/public/locales/en'
at Object.readdirSync (fs.js:1047:3)
at getLocaleNamespaces (/vercel/path0/node_modules/next-i18next/dist/commonjs/config/createConfig.js:175:23)
at /vercel/path0/node_modules/next-i18next/dist/commonjs/config/createConfig.js:181:20
at Array.map (<anonymous>)
at getNamespaces (/vercel/path0/node_modules/next-i18next/dist/commonjs/config/createConfig.js:180:44)
at createConfig (/vercel/path0/node_modules/next-i18next/dist/commonjs/config/createConfig.js:221:29)
at _callee$ (/vercel/path0/node_modules/next-i18next/dist/commonjs/serverSideTranslations.js:199:53)
at tryCatch (/vercel/path0/node_modules/regenerator-runtime/runtime.js:63:40)
at Generator.invoke [as _invoke] (/vercel/path0/node_modules/regenerator-runtime/runtime.js:294:22)
at Generator.next (/vercel/path0/node_modules/regenerator-runtime/runtime.js:119:21)}
RequestId: 1d6d712f-02d3-4029-8277-7bf418949555 Error: Runtime exited with error: exit status 1
Runtime.ExitError
Describe the bug
We have this project structure, where I need to deploy one app from monorepo to Vercel, I created simpified reprocudction in GitHub repo.
The problem is with
next-i18next.config.js
andlocalePath
. When I usepath.resolve('./public/locales')
, then the serverless function on Vercel can't find the locale files, when I usepath.resolve('./packages/parent/public/locales')
, then the pre-rendering function can't find the locale files, so there is this problem in recognizing if the config is ingetStaticProps
orgetServerSideProps
and I cant get it to work. Right now the config looks like this:I tried to play with
process.browser
andtypeof window === 'undefined'
but that did not help.When
path.resolve('./public/locales')
it crashes when trying to load SSR rendered page with error:When
path.resolve('./package/parent/public/locales')
it crashes during build with exit message:Occurs in next-i18next version
^9.2.0
Steps to reproduce
Reproduction repository:
https://github.com/jakubHynek/lerna-monorepo
There is
packages/parent
which is basic next app created withyarn create next-app --typescript
packages/child
not important for this issue - exports one basic functionSteps
follow the steps of Vercel initialization
setup vercel project on their site:
FRAMEWORK PRESET: Next.js
BUILD COMMAND:
yarn workspace parent run build
OUTPUT DIRECTORY:
packages/parent/.next
leave Root Directory setting empty
either crash at build or at server side rendered page
The text was updated successfully, but these errors were encountered: