aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
461 stars 116 forks source link

Amplify Gen2 - Next.js AssetPrefix feature not working with Nextjs version 14 #3965

Open sagshar5 opened 3 weeks ago

sagshar5 commented 3 weeks ago

Before opening, please confirm:

Amplify Hosting feature

Deployments

Is your feature request related to a problem? Please describe:

Created new Nextjs App : -> npx create-next-app@latest

Keeping static files under /assets in my project directory

updated next.config.js file as below :

  export default () => {

  const nextConfig = {
    assetPrefix: '/assets'
  }
  return nextConfig
}

host the application over Amplify Gen 2, it start throwing 404 errors for all the .css and .js files as show in screenshot below :

In browser, I am able to seeing 404 errors for files like below

http://localhost:3000/assets/_next/static/chunks/webpack-8e097dbXXXXXX63.js

Describe how you'd like this feature to work

If you inspect and go to Network, you should be able to see static files served from /assets without 404 errors

github-actions[bot] commented 3 weeks ago

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!