Skip to content
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

Pages with rewrite failing to load #1031

Closed
thiras opened this issue Mar 8, 2021 · 4 comments
Closed

Pages with rewrite failing to load #1031

thiras opened this issue Mar 8, 2021 · 4 comments

Comments

@thiras
Copy link

thiras commented Mar 8, 2021

Describe the bug

The pages with translation failed to load (500) if they have rewritten to a destination. This problem only occurs against a direct hit to the rewritten URL. Client-side navigation works totally fine.

Occurs in next-i18next version

8.1.0

Steps to reproduce

I've create a reproducible repo here; https://github.com/thiras/next-i18next-rewrite-bug Just deploy it on vercel and hit /tr/hakkimizda directly (Turkish equivalent of /about)

Expected behaviour

Translations should work with the rewrites. Rewrites are the best option to handle slug translation so far.

Screenshots

Here is the vercel error output;

[GET] /tr/hakkimizda
03:03:30:65
Status:-1
Duration:498.90 ms
Init Duration: 153.21 ms
Memory Used:87 MB
ID:7sr9j-1615161809932-f1baf335c79f
User Agent:Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0
t Object.readdirSync (fs.js:1021:3)    at getAllNamespaces (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:113:21)    at createConfig (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:118:29)    at _callee$ (/var/task/node_modules/next-i18next/dist/commonjs/serverSideTranslations.js:105: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:293:22)    at Generator.next (/var/task/node_modules/regenerator-runtime/runtime.js:118:21)    at asyncGeneratorStep (/var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)    at _next (/var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)    at processTicksAndRejections (internal/process/task_queues.js:93:5) {  errno: -2,  syscall: 'scandir',  path: '/var/task/public/locales/en'}2021-03-08T00:03:31.551Z	f7878e2d-ad85-4f03-8e02-e8badde3314d	ERROR	Error: ENOENT: no such file or directory, scandir '/var/task/public/locales/en'    at Object.readdirSync (fs.js:1021:3)    at getAllNamespaces (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:113:21)    at createConfig (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:118:29)    at _callee$ (/var/task/node_modules/next-i18next/dist/commonjs/serverSideTranslations.js:105: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:293:22)    at Generator.next (/var/task/node_modules/regenerator-runtime/runtime.js:118:21)    at asyncGeneratorStep (/var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)    at _next (/var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)    at processTicksAndRejections (internal/process/task_queues.js:93:5) {  errno: -2,  syscall: 'scandir',  path: '/var/task/public/locales/en'}2021-03-08T00:03:31.551Z	f7878e2d-ad85-4f03-8e02-e8badde3314d	ERROR	Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: ENOENT: no such file or directory, scandir '/var/task/public/locales/en'","reason":{"errorType":"Error","errorMessage":"ENOENT: no such file or directory, scandir '/var/task/public/locales/en'","errno":-2,"syscall":"scandir","path":"/var/task/public/locales/en","stack":["Error: ENOENT: no such file or directory, scandir '/var/task/public/locales/en'","    at Object.readdirSync (fs.js:1021:3)","    at getAllNamespaces (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:113:21)","    at createConfig (/var/task/node_modules/next-i18next/dist/commonjs/config/createConfig.js:118:29)","    at _callee$ (/var/task/node_modules/next-i18next/dist/commonjs/serverSideTranslations.js:105: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:293:22)","    at Generator.next (/var/task/node_modules/regenerator-runtime/runtime.js:118:21)","    at asyncGeneratorStep (/var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)","    at _next (/var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)","    at processTicksAndRejections (internal/process/task_queues.js:93:5)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: ENOENT: no such file or directory, scandir '/var/task/public/locales/en'","    at process.<anonymous> (/var/runtime/index.js:35:15)","    at process.emit (events.js:327:22)","    at processPromiseRejections (internal/process/promises.js:245:33)","    at processTicksAndRejections (internal/process/task_queues.js:94:32)"]}Unknown application error occurred

OS (please complete the following information)

  • Device: Dell 7577 with Ubuntu 20.04
  • Browser: Firefox 86.0

Additional context

Add any other context about the problem here.

@isaachinman
Copy link
Contributor

I am getting the following error, which is not related to rewrites at all:

Screen Shot 2021-03-08 at 08 49 23

@thiras
Copy link
Author

thiras commented Mar 8, 2021

@isaachinman please check again, fixed this bug. By the way, it works on yarn dev but not on Vercel.

@thiras
Copy link
Author

thiras commented Mar 8, 2021

The example repo deployed at https://next-i18next-rewrite-bug.vercel.app/about and https://next-i18next-rewrite-bug.vercel.app/tr/hakkimizda. You can clearly see the 500 error. The error is consistent with the one I've posted above.

Also please let me know if you want further information from me. I'm on Discord as thiras#0081.

Screenshot from 2021-03-08 15-48-11

@thiras
Copy link
Author

thiras commented Mar 8, 2021

I've just checked that yarn build && yarn start doesn't reproduce the problem on my local too like yarn dev. But the problem still persists on Vercel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants