I have just installed a nextjs project with npx create-next-app@latest.
current versions
"next": "14.1.3",
"react": "^18",
"react-dom": "^18",
"sharp": "^0.33.2"
next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
};
export default nextConfig;
My project is running perfectly fine locally in dev and after build.
But while deploying Nextjs Application on AWS S3 bucket with serverless I am getting the following error:
Error: Command failed with exit code 1: node_modules/.bin/next build
> Build error occurred
Error: The "target" property is no longer supported in next.config.js.
See more info here https://nextjs.org/docs/messages/deprecated-target-config
As you can see I don't have any target property on my next.config.mjs file still I am getting this error. I also tried output: "standalone" but got no success.
I can see people facing same error in stack overflow but most of the issue is related to AWS Amplify. I am using AWS S3 bucket with serverless.
Note: I have 3 Nextjs project deployed on AWS S3 with serverless with same configs only difference in this project is I am using Next version 14.1.3 here, rest all is Next version 12.0.8.
I don't know if this will help but here is my serverless.yml file below
NEXT-TEST:
component: "@sls-next/[email protected]"
inputs:
runtime:
defaultLambda: "nodejs18.x"
apiLambda: "nodejs18.x"
imageLambda: "nodejs18.x"
memory:
defaultLambda: 4096
apiLambda: 4096
imageLambda: 4096
timeout:
defaultLambda: 30
apiLambda: 30
imageLambda: 30
bucketRegion: XXXXX
bucketName: XXXXXX
To deploy I am using below command:
npx [email protected]
I have searched and tried many different solution but nothing worked for me.
Please Help!