Skip to content

DENO_AUTH_TOKENS does not authenticate against npm.pkg.github.com #19900

Open
@amitlevy21

Description

@amitlevy21

Hi,
I'm doing a POC to see if our company can start replacing node with deno.
I have a private npm package in npm.pkg.github.com that I'm trying to import.

I'm trying to run a single-line file to install the package locally:

import { Config } from "npm:@<company-name>/<package-name>/src/index.ts"

running the following command:

DENO_AUTH_TOKENS=<token>@npm.pkg.github.com NPM_CONFIG_REGISTRY=https://npm.pkg.github.com deno run -L debug file.ts

results in this error:

DEBUG RS - deno::args::config_file:756 - Config file found at '/Users/amitL/Dev/deno-poc/deno.json'
DEBUG RS - deno::args::package_json:151 - No package.json file found
DEBUG RS - deno::cache::cache_db:129 - Opening cache /Users/amitL/Library/Caches/deno/dep_analysis_cache_v1...
DEBUG RS - deno::cache::cache_db:129 - Opening cache /Users/amitL/Library/Caches/deno/node_analysis_cache_v1...
DEBUG RS - deno::auth_tokens:69 - Parsed 1 auth token(s).
DEBUG RS - deno::js:10 - Deno isolate init with snapshots.
DEBUG JS - args []
DEBUG RS - deno::worker:138 - main_module file:///Users/amitL/Dev/deno-poc/file.ts
DEBUG RS - import_map:1102 - Specifier "file:///Users/amitL/Dev/deno-poc/file.ts" was not mapped in import map.
DEBUG RS - import_map:1102 - Specifier "file:///Users/amitL/Dev/deno-poc/file.ts" was not mapped in import map.
DEBUG RS - deno::module_loader:111 - Preparing module load.
DEBUG RS - deno::module_loader:125 - Creating module graph.
DEBUG RS - deno::file_fetcher:476 - FileFetcher::fetch() - specifier: file:///Users/amitL/Dev/deno-poc/file.ts
DEBUG RS - deno_runtime::permissions:60 - ⚠️️  Granted read access to "/Users/amitL/Dev/deno-poc/file.ts"
DEBUG RS - import_map:1102 - Specifier "npm:@<company-name>/<package-name>/src/index.ts" was not mapped in import map.
DEBUG RS - reqwest::connect:429 - starting new connection: https://npm.pkg.github.com/
DEBUG RS - deno::npm::resolution:311 - Snapshot already up to date. Skipping pending resolution.
error: Error getting response at https://npm.pkg.github.com/@<company-name>/<package-name> for package "@<company-name>/<package-name>": Bad response: 401

{"error":"authentication token not provided"}

If I send a request with a client (like curl), it works, I get all the data about the package:

curl -H "Authorization: Bearer <token>" "https://npm.pkg.github.com/@<company-name>/<package-name>"

Thanks for your time!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions