Skip to content

Resolve periodic build failure in Verify Documentation Build step #96

@webchick

Description

@webchick

Is your feature request related to a problem? Please describe.

Over on #95 we got an error in the Verify Documentation Build step:

Error: Server answered with HTTP 429 when performing the request to https://registry.npmjs.org/yarn/latest; for troubleshooting help, see https://github.com/nodejs/corepack#troubleshooting
    at fetch (/opt/hostedtoolcache/node/20.20.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:22096:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async fetchAsJson (/opt/hostedtoolcache/node/20.20.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:22103:20)
    at async fetchLatestStableVersion (/opt/hostedtoolcache/node/20.20.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:22025:20)
    at async fetchLatestStableVersion2 (/opt/hostedtoolcache/node/20.20.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:22200:14)
    at async Engine.getDefaultVersion (/opt/hostedtoolcache/node/20.20.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:22881:23)
    at async Engine.findProjectSpec (/opt/hostedtoolcache/node/20.20.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:22950:40)
    at async Engine.executePackageManagerRequest (/opt/hostedtoolcache/node/20.20.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:23004:24)
    at async Object.runMain (/opt/hostedtoolcache/node/20.20.2/x64/lib/node_modules/corepack/dist/lib/corepack.cjs:23710:7)

Node.js v20.20.2
Error: Process completed with exit code 1.

Describe the solution you'd like

Have it NOT do that. ;) Not sure if there's merit here, but here's what Copilot had to say about it:


The job is failing due to an HTTP 429 (Too Many Requests) error from npm registry when corepack tries to fetch the latest yarn version.

Root Cause: The npm registry is rate-limiting requests, likely because multiple CI runs are hitting it simultaneously or the registry is experiencing throttling.

Solution:

Update the workflow to specify an explicit yarn version instead of relying on corepack to fetch the latest version dynamically. This avoids the registry request that's causing the 429 error.

Recommended Changes to .github/workflows/docs-build-check.yml:

- name: Setup Node.js
  uses: actions/setup-node@v4
  with:
    node-version: "20"
    cache: yarn  # This will cache yarn dependencies

- name: Detect package manager and install dependencies
  working-directory: documentation
  run: |
    if [ -f "yarn.lock" ]; then
      echo "Using yarn"
      corepack enable
      corepack prepare yarn@stable --activate  # Specify stable version instead of fetching "latest"
      yarn install --frozen-lockfile
    elif [ -f "pnpm-lock.yaml" ]; then
      echo "Using pnpm"
      corepack enable
      corepack prepare pnpm@stable --activate
      pnpm install --frozen-lockfile
    elif [ -f "package-lock.json" ]; then
      echo "Using npm"
      npm ci
    else
      echo "No lockfile found, using npm install"
      npm install
    fi

Key changes:

  • Replace corepack enable followed by yarn install with an explicit corepack prepare yarn@stable --activate to avoid fetching from the registry
  • Add cache: yarn to the Node.js setup step to cache dependencies and reduce registry requests

This approach avoids the dynamic registry lookup that's being rate-limited while still using corepack for consistent package manager versions.

Additional context

I have no idea what I'm doing. :D

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtooling

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions