Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has anyone been able to deploy Nuxt 3 into AWS Amplify or Lambda with SSR enabled?

Recently I have been all over my head with deploying nuxt 3 application with SSR support into AWS Amplify. Apparently even they have mentioned they support nuxt and next deployment with SSR support in here, it seems like it is quite misleading. I have tried for days to deploy it to Amplify but didn't work. After quite a digging I found these two github issues mentioning that it doesn't support SSR deployment with nuxt.

  1. https://github.com/nuxt/website-v2/issues/1091
  2. https://github.com/aws-amplify/amplify-hosting/issues/1860

Then I turned to deploy into AWS Lambda with the use of serverless framework. I found out in this post that we could do it with nuxt 3. But it is failing with the following error Cannot find module 'my-app/.output/server/index'.

Below is my setup

serverless.yaml

service: my-app

frameworkVersion: "3"

provider:
  name: aws
  runtime: nodejs18.x
  memorySize: 2048
  stage: dev
  timeout: 900
  region: us-east-1

functions:
  nuxt:
    handler: .output/server/index.handler
    events:
      - httpApi: '*'

nuxt.config.ts

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true },
  ssr: false,
  nitro: {
    preset: 'aws-lambda'
  }
})

package.json

{
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "build:lambda": "NITRO_PRESET=aws-lambda nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare",
    "deploy": "sls deploy"
  },
  "devDependencies": {
    "@nuxt/devtools": "latest",
    "@types/node": "^18.17.3",
    "nuxt": "^3.6.5"
  }
}

I have three queries,

  1. Is Amplify approach not possible yet with SSR?
  2. Is Lambda deployment with serverless framework also not working with nuxt 3?
  3. If above are not options, what would be the best approach to deploy a nuxt 3 application with SSR support into AWS?

Appreciate the help for any one of my queries.

like image 294
Neminda Prabhashwara Avatar asked Oct 29 '25 23:10

Neminda Prabhashwara


1 Answers

There's now a nitro preset for AWS Amplify- https://github.com/unjs/nitro/pull/1912

https://nitro.unjs.io/deploy/providers/aws-amplify

You should be able to deploy Nuxt3 apps on AWS Amplify using the preset

like image 184
KaushikTD Avatar answered Nov 01 '25 14:11

KaushikTD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!