1

Does anyone has tried AWS-Amplify for next.js deployment? I am getting this error always that "yarn build" successful but didn't deployed and failed.

enter image description here

Git repo is configured with auto-deployment and YML file for aws-amplify is below.

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - rm -rf node_modules
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

3
  • Please help to share the scripts section in your package.json Commented Jun 11, 2021 at 18:48
  • Did you end up solving your issue? Commented Jul 14, 2021 at 20:21
  • Amplify is often hard to debug as it acts like a black box. Check out SST, it deploys Next.js apps to your AWS account using CDK which is backed by CloudFormation template. So you have full control over what's being built and deploy. It's fully compatible with Next.js 11. Here's an example serverless-stack.com/examples/… Commented Sep 22, 2021 at 21:00

1 Answer 1

1

Use this yaml file in your build

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: public
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.