Strider-CD / strider-github

Github provider for strider
25 stars 34 forks source link

Getting a "Project not found" error when trying to connect to Github #29

Closed hernan43 closed 9 years ago

hernan43 commented 9 years ago

So I am using Strider(HEAD -> dc751b7). If I use it on my local machine everything works as advertised, I can connect to Github and pull in projects and everything seems to be firing on all cylinders.

When I try to use it on an EC2 instance, I am using it with an Nginx proxy. Everything except the Github stuff appears to work. If I try and connect to Github I get the following message on a blank white page:

Project not found

The log shows:

GET /auth/github 404 6.018 ms - 17

At first I was using it without any special config, but then I found the information here:

https://github.com/Strider-CD/strider-github#custom-hostname

So I corrected the missing information(setup a new app in Github and used the ENV vars) and restarted. I've tried using an incognito window in Google Chrome thinking maybe it was caching the page from when I was trying to use the default configuration.

I've got my ENV variables set up(In a hidden file) as:

export SERVER_NAME=https://EC2_SERVER_URL
export PLUGIN_GITHUB_APP_ID=GITHUB_ID
export PLUGIN_GITHUB_APP_SECRET=GITHUB_SECRET
export PLUGIN_GITHUB_HOSTNAME=$SERVER_NAME

I'm using a super basic bash script to launch:

#!/bin/bash
source ~/.strider_vars
cd strider
npm start

Is there something I am missing, or is there some level of debugging I can do? I combed through the existing issues and couldn't find anything quite like this. Apologies in advance!

doubliez commented 9 years ago

I have the exact same problem. I have also configured Strider and the Github plugin with these 4 environment variables, but get "Project not found" when trying to connect to Github (/auth/github).

I'm using Strider 1.6.0 and have the latest version of the github plugin according to the admin page.

jaredly commented 9 years ago

You say "when I try to connect to github" --> What's the URL that gives you the "Project not found" message?

doubliez commented 9 years ago

It's http://strider/auth/github (if http://strider is the SERVER_NAME, where I access strider).

hernan43 commented 9 years ago

In my case it is just the https version of the above.

-- edit --

To be clear it is: https://EC2_SERVER_NAME/auth/github

doubliez commented 9 years ago

If I go to http://strider/auth/github/callback, I get to authenticate on Github and everything works fine. So I can actually connect to Github now, but still, the url one should go to in order to connect to Github should be /auth/github, not /auth/github/callback (which is only the callback called after the authentication on Github).

Nepoxx commented 9 years ago

The /auth/github is coming from https://github.com/Strider-CD/strider-github/blob/master/package.json#L29 I'm having that same issue. If I go to /auth/github/callback and proceed with it, I get the following stack trace:

TypeError: Cannot read property '0' of undefined
   at makeAccount (/home/nepoxx/strider/node_modules/strider-github/lib/webapp.js:167:28)
   at Strategy.validateAuth [as _verify] (/home/nepoxx/strider/node_modules/strider-github/lib/webapp.js:152:26)
   at /home/nepoxx/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/lib/strategy.js:188:22
   at /home/nepoxx/strider/node_modules/strider-github/node_modules/passport-github/lib/strategy.js:109:5
   at passBackControl (/home/nepoxx/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:126:9)
   at IncomingMessage.<anonymous> (/home/nepoxx/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:143:7)
   at IncomingMessage.emit (events.js:117:20)
   at _stream_readable.js:944:16
   at process._tickCallback (node.js:442:13)
knownasilya commented 9 years ago

Looks like this might be due to the change to Express 4 that I brought in. Since now the extension-loader might be loading things after certain routes, so the catch-all is being called before the provider routes are configured. @jaredly does that sound right?

knownasilya commented 9 years ago

Could anyone seeing this issue try this branch: https://github.com/knownasilya/strider/tree/fix-auth-routes

jaredly commented 9 years ago

@knownasilya yeah that sounds right.

doubliez commented 9 years ago

@Nepoxx The error you're getting is related to this issue: https://github.com/Strider-CD/strider-github/issues/25

So just add your email address on your Github profile, and it should work.

Nepoxx commented 9 years ago

@doubliez That was indeed the issue (it's kinda weird that we have to fill out our public e-mail, but that's another discussion.

@knownasilya This being said, your fix works!

knownasilya commented 9 years ago

The error you're getting is related to this issue: #25

@Nepoxx @doubliez I just submitted a fix for that.

Will also be merging the changes for the fix for this issue. Although this is a temporary fix, since the routes need to be refactored anyway.. I think 1.6.1 needs to be pushed, what do you guys think?