Skip to content

Amplify Service for Nuxt 2 SSR

0

Hi, I have some NUXT 2 SSR projects hosted in Vercel (example https://stage.tec.br/) and I would like to move to Amplify AWS service. However, I cannot SSR websites. For static website I can deploy successfully. Follow my amplify file

version: 1 frontend: phases: preBuild: commands: - yarn install build: commands: - yarn build artifacts: baseDirectory: .amplify-hosting files: - '/*' cache: paths: - node_modules//*

asked a year ago132 views
1 Answer
0

AWS Amplify Hosting has recently extended its support for server-side rendering (SSR) applications, including Nuxt.js. However, it's important to note that the current support is primarily focused on Nuxt 3, which uses the Nitro server.

For your Nuxt 2 SSR projects, you may face some challenges when trying to deploy them on Amplify Hosting. The zero-configuration deployment that works seamlessly with Nuxt 3 is not available for Nuxt 2 SSR applications.

To deploy your Nuxt 2 SSR projects on Amplify, you might need to make some adjustments:

  1. Ensure you're using the latest version of Amplify Hosting that supports SSR for various frameworks.

  2. You may need to modify your build configuration to properly generate the SSR output. The .amplify-hosting directory you're using in your baseDirectory is correct for the new SSR deployment specification.

  3. Your build command might need to be adjusted to generate the correct SSR output for Amplify Hosting. Instead of just yarn build, you might need a command that specifically builds for SSR and organizes the output according to Amplify's new deployment specification.

  4. You may need to create a custom server file that Amplify can use to serve your Nuxt 2 SSR application.

  5. Ensure your nuxt.config.js file is properly configured for SSR deployment.

If you continue to face issues, you might want to consider upgrading your projects to Nuxt 3, which has built-in support for deployment on Amplify Hosting via the Nitro server adapter.

Alternatively, you could explore using AWS Elastic Beanstalk or Amazon EC2 for hosting your Nuxt 2 SSR applications, as these services offer more flexibility in terms of server configuration.

Remember, Amplify Hosting's extended SSR support is still relatively new, and the ecosystem is evolving. Keep an eye on Amplify documentation and community resources for any updates or specific guidance for Nuxt 2 SSR deployments.

Sources
Introducing Support for Hosting Any SSR app on AWS Amplify Hosting | Front-End Web & Mobile
AWS Amplify Hosting extends server-side rendering (SSR) support to additional frameworks

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.