跳至内容

deploy ssr app in Amplify

0

i deploy my nuxt app into Amplify my amplify.yaml version: 1 frontend: phases: preBuild: commands: - corepack enable - npx --yes nypm i build: timeoutInMinutes: 30 commands: - pnpm run build artifacts: baseDirectory: .output files: - "**/*"

settings: nodeVersion: "18" startCommand: "node .output/server/index.mjs"

my start command in package.json is "node .output/server/index.mjs"

url: https://nuxt.d2nn56hcyc7by2.amplifyapp.com/

still 404 error plz check it out

已提问 5 个月前102 查看次数
1 回答
0

It seems you're encountering a 404 error when trying to deploy your Nuxt SSR app on AWS Amplify. Let's review your configuration and suggest some adjustments to resolve this issue.

For Nuxt SSR apps on Amplify Hosting, there are a few key points to consider:

  1. The build settings should be adjusted to use the new SSR deployment specification.
  2. The baseDirectory should be set to .amplify-hosting instead of .output.
  3. The Nitro server adapter should be used to automatically organize files according to the deployment specification.

Here's a suggested update to your amplify.yaml file:

version: 1
frontend:
phases:
preBuild:
commands:
- nvm use 18
- corepack enable
- npx --yes nypm i
build:
commands:
- npm run build
artifacts:
baseDirectory: .amplify-hosting
files:
- '**/*'

Note that we've removed the settings section and the startCommand, as these are not necessary with the new SSR deployment specification.

The Nitro server, which is part of Nuxt, will recognize the Amplify CI/CD pipeline and automatically select the zero-config Nitro preset for deployment. This should handle the organization of files into the .amplify-hosting directory according to the deployment specification.

If you're still encountering issues after making these changes, you might want to check the following:

  1. Ensure your Nuxt version is up to date and compatible with Amplify's SSR hosting.
  2. Verify that your build command in package.json is correct (it should be something like "nuxt build").
  3. Check the Amplify Console for any build or deployment errors in the logs.

If the problem persists, you may need to enable server-side logging in the Amplify Console to capture logs in Amazon CloudWatch for more detailed debugging information.

Remember, Amplify Hosting's support for SSR applications is designed to work with minimal configuration, so these adjustments should help resolve your 404 error.
Sources
Introducing Support for Hosting Any SSR app on AWS Amplify Hosting | Front-End Web & Mobile
Deploy React and Server Side Rendered Apps and Static Sites - Amplify Hosting - AWS

已回答 5 个月前
  • that not working 2025-06-09T06:37:44.681Z [ERROR]: !!! CustomerError: Artifact directory doesn't exist: .amplify-hosting

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。