amplify-hosting
amplify-hosting copied to clipboard
Amplify fails to build Next.js App with translation using i18-next
Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the FAQ.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
App Id
d2afd0bnknw8fi
Region
us-east-1
Amplify Hosting feature
Custom builds
Describe the bug
Amplify fails succeed the command next build
when trying to build a next.js App.
The build fails right after Printing to the console: Starting SSR Build...
, in addition to showing the message:
Error: Command failed with exit code 1: node_modules/.bin/next build
warn - Invalid next.config.js options detected:
[{
"instancePath": "",
"schemaPath": "#/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "target"
},
"message": "must NOT have additional properties"
}
]
Although the property "target" doesn't exist in either of config files of next.js
contents of "next.config.js"
/* eslint-disable unicorn/prefer-module */
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
images: {
domains: ['cdn.ourdomain.com'],
},
};
contents of "next-i18next.config.js"
/* eslint-disable unicorn/filename-case */
/* eslint-disable unicorn/prefer-module */
module.exports = {
i18n: {
locales: ['en', 'fr'],
defaultLocale: 'en',
},
};
Expected behavior
After building locally, and on other OS's and even building docker images (with success), unless I am mistaken, this is a Amplify bug
Reproduction steps
- Init a next.js project with typescript support
- Add
next-i18next
package by using your package manager of choise - edit your next.config.js like follows
const { i18n } = require('./next-i18next.config');
module.exports = {
i18n,
};
- Create a file called "next-i18next.config.js"
- add the following to the file
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'de'],
},
};
- Run the command from your terminal:
npm run build
oryarn run build
- after it's success
- Configure your amplify to auto deploy from your github repo,
- it should fail on "frontend build"
Build Settings
No response
Additional information
No response
Hi @darklight147 thank you for providing these reproduction steps. We have added this to our product backlog for prioritization. Will update if we are able to find a possible workaround in the mean time.
Hi,
I am pleased to share we have now launched support for Next.js 12 and 13. This new release improves the support for Next.js's i18 plugins. For more information, please see our blog post at https://aws.amazon.com/blogs/mobile/amplify-next-js-13
If you run into issues with Next.js 12 or 13, please open a new issue so we can track it specifically. Thank you everyone for your patience and support. It's much appreciated.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.