Skip to content

Let OIDC handle npm auth (drop setup-node placeholder token) - #191

Merged
MikeAlhayek merged 1 commit into
mainfrom
claude/npm-oidc-setupnode-fix
Sep 14, 2026
Merged

MikeAlhayek merged 1 commit into
mainfrom
claude/npm-oidc-setupnode-fix

Conversation

@MikeAlhayek

Copy link
Copy Markdown
Member

Follow-up to #189 / #190. The npm@11 pin fixed the engine error, and the run reached npm publish — but it still 404'd, this time because OIDC never engaged.

Root cause

actions/setup-node@v6 with registry-url/scope writes an .npmrc containing //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} and exports a placeholder NODE_AUTH_TOKEN (XXXXXX-XXXXXX-XXXXXX-XXXXXX) to every step. npm resolved that placeholder as credentials, published with it, and skipped OIDC entirely — the log showed:

npm notice Publishing to https://registry.npmjs.org/ with tag preview and public access
npm error 404 Not Found - PUT https://registry.npmjs.org/@crestapps%2fai-chat-ui

No trusted-publishing/OIDC notice, i.e. npm used a token, not OIDC.

Fix

Remove registry-url/scope from setup-node so no _authToken (and no placeholder) is configured. With npm >= 11.5.1 and id-token: write, npm then performs the OIDC token exchange. The publish registry still comes from publishConfig.registry in src/Resources/CrestApps.AI.Resources/package.json. Also print node/npm versions for diagnostics.

Verify after merge

Trigger Publish npm (workflow_dispatch). Expect an OIDC/trusted-publishing notice and a successful publish of the next 2.0.0-preview.N to the preview tag.

🤖 Generated with Claude Code

The trusted-publishing run still 404'd because setup-node's registry-url/scope
inputs make it write an .npmrc with `_authToken=${NODE_AUTH_TOKEN}` and export a
placeholder NODE_AUTH_TOKEN (XXXXXX-XXXXXX-...). npm treated that placeholder as
credentials and published with it, never attempting OIDC -- the publish notice
showed no trusted-publishing line and the PUT returned 404.

Drop registry-url/scope so no auth token is configured; npm >= 11.5.1 with
id-token then uses OIDC. The registry target comes from publishConfig.registry
in the package's package.json. Also print node/npm versions for diagnostics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@MikeAlhayek
MikeAlhayek merged commit 7d24c09 into main Sep 14, 2026
9 checks passed
@MikeAlhayek
MikeAlhayek deleted the claude/npm-oidc-setupnode-fix branch September 14, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant