Search code examples
amazon-web-servicesnext.jsaws-amplify

Yarn Install Fails with 304 Not Modified in AWS Amplify Build Pipeline


I'm facing an issue where the build process fails in AWS Amplify during the yarn install step. Here are the details:


Build Logs Output:

2024-12-17T13:07:25.673Z [WARNING]: error An unexpected error occurred: 
"https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz: Request failed \"304 Not Modified\"".

2024-12-17T13:07:25.677Z [INFO]: info If you think this is a bug, please open a bug report 
with the information provided in "yarn-error.log".

Environment Details:

  • AWS Amplify Hosting
  • Package manager command used: yarn install --frozen-lockfile
  1. Clearing Yarn Cache: Added the --no-cache flag in the amplify.yml file: yarn install --frozen-lockfile --no-cache
  2. Clear Yarn Cache in Amplify Build:
version: 1
frontend:
  phases:
    preBuild:
      commands:
        - yarn cache clean
        - yarn install --frozen-lockfile
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - .next/cache/**/*
      - node_modules/**/*

Solution

  • The issue with "304 Not Modified" responses during package installation has been identified as a problem specific to the Mumbai, India region. It was caused by issues with the npm registry servers.

    For further updates, check the official npm incident status page.