I have an appengine (Java) app with the ability to sign in via Google. For this I use UserServiceFactory.getUserService().createLoginURL(...).
This has been working fine so far, and still works well locally (using mvn appengine:run
) but on production it consistently throws a generic 500 while on /_ah/conflogin?state=~AJKiYcHHHXI45-...
(the 5th URL of the login process, while already being logged in with Google) and I can find nothing relevant in the Logs Explorer at https://console.cloud.google.com/logs/...
I've since even updated to the latest https://mvnrepository.com/artifact/com.google.appengine/appengine-api-1.0-sdk/2.0.10 but the problem remains.
Where should I look at to solve this issue?
CodePudding user response:
To find the root cause of this issue, you can find the logs for this error will be helpful.
In this documentation there is a sample query that you could try to check for logs error with status 500.
resource.type="gae_app" AND
log_id("appengine.googleapis.com/request_log") AND
httpRequest.status>=500
Alternatively you could also try running ‘gcloud app logs read’ as mentioned in this document to see if you get any logs.
The issue tracker mentioned by Rez in comment is marked as Fixed and after checking your issue I think it also relates to the same issue tracker. As it closed I suggest to get your issue resolved I recommend to raise new issue tracker by referencing the fixed one or else you may raise support ticket with google
CodePudding user response:
First, I would check the AppEngine logs to see if you can find any clues as to what is causing the 500 error. You can do this by going to the Logs Explorer in the GCP console (https://console.cloud.google.com/logs/).
If the error is not being logged in the AppEngine logs, then you can try debugging the code to see where the error is occurring. You can do this by setting breakpoints in your code and examining the state of the variables when the error occurs. This will help you narrow down the source of the error and allow you to fix it.
If the error is still not clear, then you can try enabling verbose logging for the UserServiceFactory class. This will allow you to get more detailed information about what is happening in the background and can help you pinpoint the source of the error.
CodePudding user response:
One possible cause of this issue is that the UserServiceFactory.getUserService().createLoginURL() method is not being called from within a request-handling thread. This method is designed to be called from within a request-handling thread, and it may throw an exception if it is called from outside of a request-handling thread.
To solve this issue, you can try wrapping the call to the createLoginURL() method in a RequestFactory. This will ensure that the method is called from within a request-handling thread, and it should prevent the exception from being thrown.
Additionally, you may want to check the logs for your App Engine app to see if there are any other error messages that can provide more information about what is causing the 500 error. You can access the logs for your app by going to the Logs Explorer in the Google Cloud Console, and looking for logs that are associated with your app and the "/_ah/conflogin" URL.