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

hasHTTPCapability issue with bitbucket shortcut resolver and private repo #4393

Closed
bertho-zero opened this issue Sep 11, 2017 · 7 comments
Closed
Assignees
Labels

Comments

@bertho-zero
Copy link
Contributor

bertho-zero commented Sep 11, 2017

It's a bug.

If I have a private dependency like "activities": "bitbucket:openagenda/activities" in my package.json, and I run yarn install --verbose then I have this error:

[1/4] Resolving packages...
verbose 0.407 Performing "HEAD" request to "https://bitbucket.org/openagenda/es-node".
verbose 0.867 Request "https://bitbucket.org/openagenda/es-node" finished with status code 302.
verbose 0.873 Performing "GET" request to "https://bitbucket.org/openagenda/es-node.git/info/refs?service=git-upload-pack".
verbose 0.98 Request "https://bitbucket.org/openagenda/es-node.git/info/refs?service=git-upload-pack" finished with status code 401.
verbose 0.981 Error: Error connecting to repository. Please, check the url.
    at /home/bertho/.config/yarn/global/node_modules/yarn/lib/cli.js:33269:15
    at Generator.next (<anonymous>)
    at step (/home/bertho/.config/yarn/global/node_modules/yarn/lib/cli.js:92:30)
    at /home/bertho/.config/yarn/global/node_modules/yarn/lib/cli.js:103:13
    at process._tickCallback (internal/process/next_tick.js:109:7)
error An unexpected error occurred: "Error connecting to repository. Please, check the url.".
info If you think this is a bug, please open a bug report with the information provided in "/home/bertho/OpenAgenda/cibul-node/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

How to force usage of ssh instead of https for a shortcut of github/bitbucket ?

Please mention your node.js, yarn and operating system version.

$ node -v
node 7.10.1
$ yarn -v
yarn 1.0.0
$ uname -a
Linux bertho-X751LB 4.4.0-92-generic #115-Ubuntu SMP Thu Aug 10 09:04:33 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
@bertho-zero
Copy link
Contributor Author

This is a problem with this.hasHTTPCapability in src/resolvers/exotics/hosted-git-resolver.js that returns true when it should not.

@BYK
Copy link
Member

BYK commented Sep 11, 2017

@bertho-zero why do you think this is a bug? BitBucket indeed seems like to be supporting HTTP?

This looks like a permission/credentials issue to me and the error message doesn't reflect that so may be we should update that instead?

@bertho-zero
Copy link
Contributor Author

bertho-zero commented Sep 12, 2017

@BYK This is for a private repo so I would need to use the ssh connection, and currently I have a redirection (with status code 302) to the login page from the request to bitbucket.

@BYK
Copy link
Member

BYK commented Sep 12, 2017

@bertho-zero are you providing the login credentials anyway? Guessing not so I'm not very surprised with the login page. Why is it not okay to use the git+ssh or git+https protocols instead of the shorthand?

@BYK
Copy link
Member

BYK commented Sep 12, 2017

@bertho-zero oh NVM, now I see the issue. I'm not sure if this is easily fixable since the HEAD request returns with a 302 instead of a 200. May be that's okay but I bet we should only expect a 2xx response from that.

We may also look into adding specific protocol selectors for these such as bitbucket+ssh and bitbucket+https. Would you be willing to open a PR for any of these?

@bertho-zero
Copy link
Contributor Author

I was trying to migrate from npm to yarn, I have a fifty repos that use shortcut and I do not want to modify all my package.json.

@BYK
Copy link
Member

BYK commented Sep 12, 2017

@bertho-zero sorry, I wasn't proposing an "either/or" solution. I think the automatic check should be fixed. I'm asking in adding the protocol specifiers, in addition to that.

@bertho-zero bertho-zero changed the title Prefer ssh for exotic resolvers with shortcut hasHTTPCapability issue with bitbucket shortcut resolver and private repo Oct 4, 2017
bertho-zero added a commit to bertho-zero/yarn that referenced this issue Oct 4, 2017
…ivate repo (Closes yarnpkg#4393)

* fix setRefRemote issue with exotic shortcut resolvers and branch/tag/commit
BYK pushed a commit that referenced this issue Oct 6, 2017
…tories (#4633)

**Summary**

* fix hasHTTPCapability issue with bitbucket shortcut resolver and private repo (#4393)
  *bug with a private repo that used like `"module": "bitbucket:team/repo"`*
* fix setRefRemote issue with exotic shortcut resolvers and branch/tag/commit
  *bug with a repo that used like `"module": "bitbucket:team/repo#tag"`*

**Test plan**

If I have a private dependency like `"activities": "bitbucket:openagenda/activities"` in my package.json, and I run `yarn install --verbose` then I have this error:

```
[1/4] Resolving packages...
verbose 0.407 Performing "HEAD" request to "https://bitbucket.org/openagenda/es-node".
verbose 0.867 Request "https://bitbucket.org/openagenda/es-node" finished with status code 302.
verbose 0.873 Performing "GET" request to "https://bitbucket.org/openagenda/es-node.git/info/refs?service=git-upload-pack".
verbose 0.98 Request "https://bitbucket.org/openagenda/es-node.git/info/refs?service=git-upload-pack" finished with status code 401.
verbose 0.981 Error: Error connecting to repository. Please, check the url.
    at /home/bertho/.config/yarn/global/node_modules/yarn/lib/cli.js:33269:15
    at Generator.next (<anonymous>)
    at step (/home/bertho/.config/yarn/global/node_modules/yarn/lib/cli.js:92:30)
    at /home/bertho/.config/yarn/global/node_modules/yarn/lib/cli.js:103:13
    at process._tickCallback (internal/process/next_tick.js:109:7)
error An unexpected error occurred: "Error connecting to repository. Please, check the url.".
info If you think this is a bug, please open a bug report with the information provided in "/home/bertho/OpenAgenda/cibul-node/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
```
@BYK BYK closed this as completed Oct 16, 2017
joaolucasl pushed a commit to joaolucasl/yarn that referenced this issue Oct 27, 2017
…tories (yarnpkg#4633)

**Summary**

* fix hasHTTPCapability issue with bitbucket shortcut resolver and private repo (yarnpkg#4393)
  *bug with a private repo that used like `"module": "bitbucket:team/repo"`*
* fix setRefRemote issue with exotic shortcut resolvers and branch/tag/commit
  *bug with a repo that used like `"module": "bitbucket:team/repo#tag"`*

**Test plan**

If I have a private dependency like `"activities": "bitbucket:openagenda/activities"` in my package.json, and I run `yarn install --verbose` then I have this error:

```
[1/4] Resolving packages...
verbose 0.407 Performing "HEAD" request to "https://bitbucket.org/openagenda/es-node".
verbose 0.867 Request "https://bitbucket.org/openagenda/es-node" finished with status code 302.
verbose 0.873 Performing "GET" request to "https://bitbucket.org/openagenda/es-node.git/info/refs?service=git-upload-pack".
verbose 0.98 Request "https://bitbucket.org/openagenda/es-node.git/info/refs?service=git-upload-pack" finished with status code 401.
verbose 0.981 Error: Error connecting to repository. Please, check the url.
    at /home/bertho/.config/yarn/global/node_modules/yarn/lib/cli.js:33269:15
    at Generator.next (<anonymous>)
    at step (/home/bertho/.config/yarn/global/node_modules/yarn/lib/cli.js:92:30)
    at /home/bertho/.config/yarn/global/node_modules/yarn/lib/cli.js:103:13
    at process._tickCallback (internal/process/next_tick.js:109:7)
error An unexpected error occurred: "Error connecting to repository. Please, check the url.".
info If you think this is a bug, please open a bug report with the information provided in "/home/bertho/OpenAgenda/cibul-node/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants