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

Installation of Scoped Registry for Gitlab Projects fails #29

Closed
Blackclaws opened this issue Jul 15, 2021 · 6 comments
Closed

Installation of Scoped Registry for Gitlab Projects fails #29

Blackclaws opened this issue Jul 15, 2021 · 6 comments

Comments

@Blackclaws
Copy link

Blackclaws commented Jul 15, 2021

Gitlab while not allowing searching of packages does allow hosting of packages at least on project level under a path like:

gitlabHost/api/v4/projects/projectID/packages/npm/

I tried to set up such a scoped registry using openupm-cli:

npx openupm-cli --no-upstream -v -r https://redactedURL/api/v4/projects/39/packages/npm/ add redactedPackageName

however openupm does not try to authenticate and then just shows the package as 404:

verb request no auth needed
SNIP
ERR! 404 package not found:

I haven't looked into the code and it might be that openupm-cli just tries to search for the package first, which fails because gitlab does not support searching for packages.

Adding the package manually into manifest.json and setting up the scoped registry manually works fine.

I should also add that installing the package via npm into any directory also works fine.

@favoyang
Copy link
Member

Hi @Blackclaws,

Thanks for reporting the issue. I'm not a GitLab user, so could you provide a public testable URL (from you or others), so I can test it?

@Blackclaws
Copy link
Author

I'll see what I can do. The non self-hosted instance only supports scoped packages which upm does not accept anyway. I'll get back to you on that.

@Blackclaws
Copy link
Author

Blackclaws commented Sep 8, 2021

I've debugged this a bit more. It turned out to actually be an issue of how the --registry flag is parsed vs how its written in the .upmconfig

The registry command line option strips off the final / in the path because its added back in.
When looking for auth entries it will not match an entry that has a final slash set as it was in my .upmconfig

This is a bit nontrivial to debug, one possible solution is to apply the same stripping logic to the urls retrieved from the .upmconfig.

If you'd like I'll submit a pull request, this is a general issue with registries that are defined with authentication including a final slash in .upmconfig

@favoyang
Copy link
Member

favoyang commented Sep 8, 2021

This is a bit nontrivial to debug, one possible solution is to apply the same stripping logic to the urls retrieved from the .upmconfig.

Oh, that's a good catch.

If you'd like I'll submit a pull request, this is a general issue with registries that are defined with authentication including a final slash in .upmconfig

It seems a good solution. PR is welcome.

github-actions bot pushed a commit that referenced this issue Jan 2, 2024
## [1.19.5](1.19.4...1.19.5) (2024-01-02)

### Bug Fixes

* trailing slash issue when finding auth in upmconfig ([#94](#94)) (close [#29](#29)) ([162f5e8](162f5e8))
@favoyang
Copy link
Member

@all-contributors please add @Blackclaws for bug.

Copy link
Contributor

@favoyang

I've put up a pull request to add @Blackclaws! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants