Reputation: 1
I am experiencing an issue with next-i18next translations in my Next.js project during AWS ECS deployments. Here’s the situation:
Issue Steps:
My Setup:
getStaticProps in pages/index.tsx:
export async function getStaticProps({
locale,
locales,
}: IDefaultGetStaticProps) {
return {
props: {
...(await serverSideTranslations(locale, [
...commonNamespaces,
'dashboard',
])),
locales,
},
};
}
What I Tried:
const path = require('path');
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'ko'],
defaultNS: 'common',
localeDetection: true,
},
localePath: path.resolve('./public/locales'),
};
const { i18n } = require('./next-i18next.config');
module.exports = {
output: 'standalone',
reactStrictMode: true,
i18n,
transpilePackages: ['helper'],
webpack: (config) => {
config.resolve.alias.canvas = false;
return config;
},
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'Access-Control-Allow-Origin',
value: 'My-Devloped-Web-Url',
},
{
key: 'Access-Control-Allow-Methods',
value: 'GET,OPTIONS,PATCH,DELETE,POST,PUT',
},
{
key: 'Access-Control-Allow-Headers',
value:
'X-CSRF-Token, X-Requested-With, Accept, Content-Type, Authorization',
},
],
},
{
source: '/locales/:all*',
headers: [
{
key: 'Cache-Control',
value: 'no-store, must-revalidate',
},
],
},
];
},
};
}
export async function middleware(req: NextRequest) {
...
}
export const config = {
matcher: [
'/',
'/locales/:path*',
'/((?!api|_next/static|_next/image|images|assets|favicon|mockServiceWorker|fonts).*)'
]
}
Despite these attempts, the issue persists.
What I Suspect:
Upvotes: 0
Views: 21