Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom registry URL is truncated for token config #46

Closed
hermann-noll opened this issue Nov 17, 2021 · 1 comment
Closed

Custom registry URL is truncated for token config #46

hermann-noll opened this issue Nov 17, 2021 · 1 comment
Labels
question Further information is requested

Comments

@hermann-noll
Copy link

I had a problem where the action would fail with 403 when trying to push to a custom registry. I noticed that in the .npmrc the registry URL was truncated (so instead of //some.domain/a/path/:_authToken=${INPUT_TOKEN} there was //some.domain/:_authToken=${INPUT_TOKEN}).

With a small change in npm-config.ts to use the full URL the action succeeded without any further problems:

  let authDomain = registry.href.slice(registry.protocol.length);
  if (!authDomain.endsWith("/"))
    authDomain += "/";
@mcous mcous added bug Something isn't working question Further information is requested and removed bug Something isn't working labels Apr 7, 2023
@mcous
Copy link
Member

mcous commented Apr 10, 2023

I'm new to the codebase, but it appears stripping the path off the registry input to use only the origin for the auth block is intentional. Going off this snippet from the npm auth docs...

@myorg:registry=https://somewhere-else.com/myorg
@another:registry=https://somewhere-else.com/another

; would apply to both @myorg and @another
//somewhere-else.com/:_authToken=MYTOKEN

; would apply only to @myorg
//somewhere-else.com/myorg/:_authToken=MYTOKEN1

; would apply only to @another
//somewhere-else.com/another/:_authToken=MYTOKEN2

...an auth setting of //example.com/:_authToken=ABC123 will apply to to a registry setting of registry=https://example.com/some/path/. Is it possible your 403 errors were caused by something else?

Since this issue is quite old and I don't see any obvious bugs in the code, I'm going to close this as "cannot reproduce." Let me know if you are still encountering this 403 issue and we can investigate / re-open if necessary.

@mcous mcous closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants