跳至內容

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//*

已提問 1 年前檢視次數 144 次
1 個回答
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

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。