FirebaseExtended / FirebaseExtended/action-hosting-deploy

[BUG] The action fails to authenticate to private npm registry

Open
#379 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
809
Forks
232
PR merge metrics
No merged PRs in 30d

Description

### Action config

This is a slightly modified (from default generated) workflow that I have:

```yml
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- develop
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: "https://npm.pkg.github.com"
scope: "@org-name"
always-auth: true
- run: npm ci && npm run build
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_FIREBASE_SANDBOX_425310 }}
channelId: live
projectId: firebase-sandbox-425310
env:
FIREBASE_CLI_EXPERIMENTS: webframeworks,pintags
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
```

### Error message

Firebase deployment fails with `nnpm ERR! 401 Unauthorized - GET https://npm.pkg.github.com/download/@org-name/app-components-frontend/0.18.33/233b5141a9f47e0a5863ebb4cd714b82c4c87100 - authentication token not provided`

### Expected behavior

While `npm ci` works fine because it uses an `.npmrc` file generated by the `setup-node` action, firebase hosting deploy action doesn't seem to be picking that up.

I've tried to find something in the docs of either firebase tools or the action, but didn't find anything that would help me resolve this.

### Actual behavior

Auth to npm registry fails and hence deployment fails

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the workflow using actions/setup-node, the generated .npmrc, and NODE_AUTH_TOKEN, then inspect how FirebaseExtended/action-hosting-deploy runs the deployment. Compare the successful npm ci step with the failing Firebase deployment and verify that a private npm package can authenticate during deployment without exposing the token.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, node.js, typescript
Domain
ci-cd, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.