question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Next.js 13 - Error: The "target" property is no longer supported in next.config.js, Even next.config.js does not have the target property

See original GitHub issue

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.0.0
      npm: 8.15.1
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.0.0
      eslint-config-next: 13.0.0
      react: 18.2.0
      react-dom: 18.2.0

What browser are you using? (if relevant)

Chrome

How are you deploying your application? (if relevant)

AWS Amplify

Describe the Bug

I upgraded my next.js app to Next.js 13 and pushed the new version to AWS Amplify. The build failed due to this error: The “target” property is no longer supported in next.config.js

Error: The "target" property is no longer supported in next.config.js. See more info here https://nextjs.org/docs/messages/deprecated-target-config at Object.loadConfig [as default (/codebuild/output/src405507991/src/assistian/node_modules/next/dist/server/config.js:97:19)

Here is my next.config.js with no target:

/** @type {import('next').NextConfig} */
module.exports = {
  webpack(config) {
    config.module.rules.push({
      test: /\.svg$/i,
      issuer: /\.[jt]sx?$/,
      use: ['@svgr/webpack'],
    })
    return config
  }
}

Expected Behavior

Next.js app should build successfully on AWs Amplify after upgrading to version 13.

Link to reproduction

NA

To Reproduce

Upgrade a next.js app to Next.js 13 and push to AWS Amplify for hosting.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
awareness481commented, Oct 27, 2022

According to this https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html#supported-unsupported-features amplify supports only up to Next v11 .

It seems like amplify is adding the target property to next.config.js which is not supported in v13.

2reactions
jedwards1230commented, Oct 27, 2022

I am also running into this error. I had Next.js latest specified in the Amplify Build Settings and am currently unable to build my apps with that. I kept running into the issue with the target property.

After changing my Amplify Build Settings to version 12 (which, I think, is what it would’ve been using a few days ago under the latest tag), I now run into Cannot find any generated SSR resources to deploy at the deploy stage. I know Amplify does not officially support Next 12, but I was having no issues running builds a few days ago.

Are you still able to build Next.js 12 apps? Have you found any workarounds?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The "target" property is no longer supported in next.config.js ...
Next.js 13 - Error: The "target" property is no longer supported in next.config.js, Even next.config.js does not have the target property.
Read more >
Cannot turn off access control for the Next.js app #3133 - GitHub
It seems like Amplify is adding the target property to next.config.js which is not supported in Next 13. Expected behavior. It should build...
Read more >
next.config.js: Introduction
js is a regular Node.js module, not a JSON file. It gets used by the Next.js server and build phases, and it's not...
Read more >
Manual Setup for Next.js - Sentry Documentation
Use withSentryConfig to extend the default Next.js usage of Webpack. This will do two things: Automatically call the code in sentry.server.config.js and sentry ......
Read more >
To v5 from v4 - webpack
Upgrade webpack 4 and its plugins/loaders · Make sure your build has no errors or warnings · Make sure to use mode ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found