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

Cannot read property 'split' of undefined #26

Closed
frangio opened this issue Nov 1, 2019 · 6 comments · Fixed by #27
Closed

Cannot read property 'split' of undefined #26

frangio opened this issue Nov 1, 2019 · 6 comments · Fixed by #27

Comments

@frangio
Copy link
Contributor

frangio commented Nov 1, 2019

Seeing the above error here:

scopes: scope.split(/,\s*/).filter(Boolean)

I have not set any OAuth scopes for my App.

@frangio
Copy link
Contributor Author

frangio commented Nov 1, 2019

Okay, it seems I'm getting the following response from GitHub:

  data:
   { error: 'redirect_uri_mismatch',
     error_description:
      'The redirect_uri MUST match the registered callback URL for this application.',

I had passed a random redirectUrl. Perhaps this function should check for errors in the response, though?

@gr2m
Copy link
Contributor

gr2m commented Nov 1, 2019

Agree, it should! I'm currently working on other parts of Octokit but happy to review a pull request if you would like to give it a go.

@frangio
Copy link
Contributor Author

frangio commented Nov 1, 2019

I've been looking at this a bit and to me it seems like a there is a bug in @octokit/request. It should be rejecting the promise but it isn't.

Perhaps the status code in this situation is not being taken as an error. I'll reproduce to see what status it is.

@gr2m
Copy link
Contributor

gr2m commented Nov 2, 2019

Ah I remember there was sth super odd about the POST https://github.com/login/oauth/access_token endpoint, the status code is not set correctly in case of an error. I'm sure I fixed this before ... but might got lost or it's in another repo. The POST https://github.com/login/oauth/access_token endpoint is such a pita :/

Can you start a PR with a failing test and we take it from there?

@frangio
Copy link
Contributor Author

frangio commented Nov 2, 2019

Sure! I've opened octokit/request.js#94.

@octokitbot
Copy link
Collaborator

🎉 This issue has been resolved in version 2.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants