nuxt / nuxt.com

The Nuxt website, made with Nuxt.
https://nuxt.com
MIT License
300 stars 154 forks source link

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

Open idorenyinudoh opened 11 months ago

idorenyinudoh commented 11 months ago

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.

pi0 commented 11 months ago

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 👍🏼

idorenyinudoh commented 11 months ago

okay, thanks for the clarification and feedback!

mauerbac commented 11 months ago

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

idorenyinudoh commented 11 months ago

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