nuxt / nuxt.com

The Nuxt website, made with Nuxt.

Home Page:https://nuxt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve setup steps on deploying Nuxt app to AWS Amplify on docs

idorenyinudoh opened this issue · comments

Affected page

https://nuxt.com/deploy/aws-amplify

Description

The documentation states that the integration of a Nuxt 3 app with AWS Amplify requires zero configuration. But that is not the case and I'll explain why.

The default build config that AWS Amplify generates is this:

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

However, Nuxt's build (and generate) command generates an .output directory that contains the app's contents ready to be served.

Hence, the baseDirectory property in Amplify's build config will need to be updated to .output/public. Hence, Nuxt's integration with AWS Amplify isn't zero config.

Happy to open a PR.

P.S: Nitro's docs might be misleading as well.

Hi, dear @idorenyinudoh thanks for sharing feedback. The baseDirectory property is correct when we are building within Amplify CI/CD build pipeline, Nitro automatically switches to aws_amplify preset and generates the required structure into .amplify-hosting (you can replicate locally by using --preset amplify_hosting arg or SERVER_PRESET=amplify_hosting).

In regards of zero configs, the yml is fairly a static configuration we advise to add to allow furthor customizatiom however amplify UI should be already able to autodetect Nuxt/Nitro and configure it hence zero config is required.

I will relay your feedback to the amplify team 👍🏼

okay, thanks for the clarification and feedback!

@idorenyinudoh - let me know if you were able to deploy to AWS Amplify and have any feedback or comments

yeah i was able to but, to get a successful deployment, i had to edit the default config generated by amplify
my only concern is I expected it to be zero config as stated on the docs