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

500 error on github OAuth2 login #1012

Closed
morrildl opened this issue Feb 22, 2017 · 9 comments · Fixed by #1021
Closed

500 error on github OAuth2 login #1012

morrildl opened this issue Feb 22, 2017 · 9 comments · Fixed by #1021
Labels
Milestone

Comments

@morrildl
Copy link
Contributor

I've been tracking #679 and #26 and this morning I figured I'd give it a try. Looks like a small oversight in DB creation on init.

I created the Github OAuth2 app scope, entered the keys, etc. From logs, the OAuth2 flow completed fine, but the result 500s with this in the log:

[Macaron] 2017-02-22 09:07:00: Started GET /user/oauth2/Zomg/callback?code=86f771c0cb21e266ea46&state=7845f8a6-c638-441b-84de-a24c4dafe260 for 172.17.0.1
[Macaron] 2017-02-22 09:07:01: Completed /user/oauth2/Zomg/callback?code=86f771c0cb21e266ea46&state=7845f8a6-c638-441b-84de-a24c4dafe260 500 Internal Server Error in 979.07248ms

...and this in the UI in dev mode:

An error has occurred : pq: relation "external_login_user" does not exist

Application Version: 1.0.0+304-g29c6f32a

Looks like a database didn't get created on initialization. This is just an instance of the Dockerhub image last pushed a few hours ago.

@morrildl
Copy link
Contributor Author

Possibly worth noting that in the setup wizard thing I created the instance with account registration disabled, but then enabled it after my first OAuth2 login failed with the 500, figuring that might be the cause.

@strk
Copy link
Member

strk commented Feb 22, 2017 via email

@morrildl
Copy link
Contributor Author

morrildl commented Feb 22, 2017

Yes, this is a 100% clean build, with a fresh database.

AFAICT the problem is that ExternalLoginUser was added to migrations, but wasn't added to the module init in models/models.go. At least, with this diff on master it's fixed, and I can log in:

diff --git a/models/models.go b/models/models.go
index 33268fa..a993e50 100644
--- a/models/models.go
+++ b/models/models.go
@@ -114,6 +114,7 @@ func init() {
                new(TwoFactor),
                new(RepoUnit),
                new(RepoRedirect),
+               new(ExternalLoginUser),
        )
 
        gonicNames := []string{"SSL", "UID"}

Happy to work that up as a PR if you like, but it'd take me a bit to get a proper fork set up to generate the PR against, etc.

Also it looks like @willemvd has another PR in flight, so assuming this is the correct fix, might be simplest to just include it in there.

@strk
Copy link
Member

strk commented Feb 22, 2017 via email

@strk
Copy link
Member

strk commented Feb 22, 2017 via email

@morrildl
Copy link
Contributor Author

It happened to me on a new install, but I don't have an existing install to test against.

@willemvd
Copy link
Contributor

Will test it against a clean setup tomorrow (+- 9 hours from now :) ) and provide a PR if required like you suggested (will also have a look to fix #1015 in that same PR)

@willemvd
Copy link
Contributor

willemvd commented Feb 22, 2017

Btw , try.gitea.io is upgraded and configured against Github, so existing install is working ;)

@lunny
Copy link
Member

lunny commented Feb 23, 2017

@morrildl I think you are right, please send a PR

@lunny lunny added this to the 1.1.0 milestone Feb 23, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants