I’m experiencing an issue with a NestJS project I am working on. The project includes a set of Firebase Functions, and I’m trying to integrate a private Node package published through GitHub Packages.
The package is named @letvarhq/oboe
. In order to make it work, I have created a .npmrc
file in the root folder of the project with the following content:
@letvarhq:registry=https://npm.pkg.github.com/letvarhq
//npm.pkg.github.com/:_authToken=${GH_PACKAGES_ACCESS_TOKEN}
GH_PACKAGES_ACCESS_TOKEN
is a personal access token created on my personal GitHub with the read:packages
scope, and it is injected in the project through a .env
file:
[...]
GH_PACKAGES_ACCESS_TOKEN="the access token"
[...]
Then, I installed the package correctly through npm i @letvarhq/oboe
, and it works fine.
Now I want to deploy the Firebase Functions with GitHub Actions. The pipeline steps to build and deploy the Functions are the following:
[...]
- name: Set up Node.js
uses: actions/setup-node@v3
with:
registry-url: 'https://npm.pkg.github.com/'
- name: Install npm packages
run: |
npm install
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy -P dev --only functions,hosting:api-dev
env:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
GH_PACKAGES_ACCESS_TOKEN: ${{ secrets.GH_PACKAGES_ACCESS_TOKEN }}
However, when I try to deploy – either locally with firebase deploy -P dev --only functions,hosting:api-dev --debug
or via GitHub Actions – I get the following error:
npm error code E401
nom error 401 Unauthorized - GET https://npm.pkg.github.com/download/@letvarhq/oboe/0.1.7/5929fe5e45cf80a336a7d2aaf6a087c5ff1340d7
- unauthenticated: User cannot be authenticated with the token provided.
npm error A complete log of this run can be found in: /www-data-home/.npm/_logs/2024-08-30T14_39_40_220Z-debug-0.log;
Error ID: beaf8772
Any idea why I keep getting this error, and how can I get the logs at /www-data-home/.npm/_logs/2024-08-30T14_39_40_220Z-debug-0.log
?