action-hosting-deploy icon indicating copy to clipboard operation
action-hosting-deploy copied to clipboard

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

Open serpro69 opened this issue 1 year ago • 3 comments

Action config

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

# 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

serpro69 avatar Jun 04 '24 04:06 serpro69