Skip to content
This repository has been archived by the owner on Jan 28, 2025. It is now read-only.

ISR fails with next-i18next #1634

Closed
GuillaumeSD opened this issue Sep 4, 2021 · 1 comment
Closed

ISR fails with next-i18next #1634

GuillaumeSD opened this issue Sep 4, 2021 · 1 comment

Comments

@GuillaumeSD
Copy link

Issue Summary

Regeneration of ISR pages using next-i18next fails.

Actual behavior

Regeneration fails because lambda keeps crashing, this is the error message I get :

{
    "errorType": "Error",
    "errorMessage": "next-i18next was unable to find a user config",
    "stack": [
        "Error: next-i18next was unable to find a user config",
        "    at _callee$ (/var/task/node_modules/next-i18next/dist/commonjs/serverSideTranslations.js:193:19)",
        "    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 /var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7",
        "    at new Promise (<anonymous>)",
        "    at /var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12",
        "    at serverSideTranslations (/var/task/node_modules/next-i18next/dist/commonjs/serverSideTranslations.js:247:17)"
    ]
}

Expected behavior

Page built with no issue in SSR, so it should too in ISR.

Steps to reproduce

Any ISR page with next-i18next should reproduce the issue.

What worked for me

Use the postBuildCommands to run a script after build and before deploy that adds next-i18next.config.js and the public/locales folder to the .serverless_nextjs/regeneration-lambda folder.

It seems that this has already been done for the default lambda, see this, but not for the regeneration lambda.
That's why the same page works in SSR but not in ISR.

@GuillaumeSD GuillaumeSD changed the title ISR not working with next-i18next ISR fails with next-i18next Sep 4, 2021
@dphang
Copy link
Collaborator

dphang commented Sep 8, 2021

Ya, looks like that needs to be added. I can add it in the next day or so

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

No branches or pull requests

2 participants