Skip to content

Still 401 when retrieving a package manager binary from artifactory as an authenticated NPM registry #733

@Enrice

Description

@Enrice

This refers to closed #275

Sorry for ME being the bearer of bad news, but this is still no longer working.

My setup:
artifactory as private registry, requests have to be authorized.
nodejs 22.18.0
corepack 0.34.0

Authentication is setup using env variables:

COREPACK_NPM_REGISTRY=https://some.host/artifactory/api/npm/registry
COREPACK_NPM_TOKEN=<token>

When I do:
corepack install pnpm@latest -g

There happen to be 3 requests, the third is unauthorized:

https://some.host/artifactory/api/npm/registry/pnpm
https://some.host/artifactory/api/npm/registry/pnpm/10.14.0
https://some.host/artifactory/api/npm/registry/

One reason might be

if (input.origin === (process.env.COREPACK_NPM_REGISTRY || DEFAULT_NPM_REGISTRY_URL) && process.env.COREPACK_NPM_TOKEN) {

which is incorrect in my view, because input.origin happens to be https://some.host without a path, so this expression can never be true.

But even then - the 3rd request is crap anyway, it should be something like that, but it isn't:
https://some.host/artifactory/api/npm/registry/pnpm/-/pnpm-10.14.0.tgz

Why?

This seems to be related to #725

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