This repository was archived by the owner on May 7, 2026. It is now read-only.
fix(ci): scrub CodeArtifact registry= line before npm publish#3
Merged
Conversation
The publish workflow's `aws codeartifact login` step writes a top-level `registry=...amazonaws.com/...` line to the runner's ~/.npmrc that overrides setup-node's `registry-url` of https://registry.npmjs.org. The result: `npm publish` routes the tarball to the private CodeArtifact registry, where the OIDC role is reader-only, and the publish 403s. Fix: 1. After CodeArtifact login + install + build, scrub the top-level `registry=...d.codeartifact.us-east-2.amazonaws.com/...` line from $HOME/.npmrc. The scoped `@openloop:registry=` line stays intact for the install side (already happened by this point). 2. Pass `--registry https://registry.npmjs.org/` explicitly to `npm publish` as belt-and-suspenders against future runner-image ~/.npmrc behavior changes. Companion to memory rule `feedback_codeartifact_login_global_registry_trap`, which already documents the pnpm-lockfile-bake-in failure mode of the same root cause. The publish-time symptom is the 403 we just hit on the v0.1.0 first-publish attempt (run 25474199020). Refs: NGP-338
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The v0.1.0 first-publish attempt (run 25474199020) failed with a 403 from CodeArtifact:
```
npm error 403 Forbidden - PUT https://openloop-957905603411.d.codeartifact.us-east-2.amazonaws.com/npm/platform-libs/@openloop%2fwebhook-receiver
is not authorized to perform: codeartifact:PublishPackageVersion
```
Root cause: `aws codeartifact login --tool npm` writes a top-level `registry=https://...d.codeartifact.us-east-2.amazonaws.com/...` line to the runner's `~/.npmrc`. That overrides setup-node's `registry-url: https://registry.npmjs.org\`, and `npm publish` follows the .npmrc to CodeArtifact (where the OIDC role is reader-only).
Same root cause as memory rule `feedback_codeartifact_login_global_registry_trap` — that rule documents the pnpm-install/lockfile-bake-in symptom; this is the publish-time symptom of the same trap.
Fix
Test plan
After this lands, re-tag v0.1.0 on the new main HEAD and re-trigger publish. Expected: `npm publish` targets registry.npmjs.org, succeeds with `NPM_TOKEN` auth.
Refs: NGP-338