Saltar al contenido

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

preguntada hace 5 meses102 visualizaciones
1 Respuesta
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

respondido hace 5 meses
  • that not working 2025-06-09T06:37:44.681Z [ERROR]: !!! CustomerError: Artifact directory doesn't exist: .amplify-hosting

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.