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

WCP call to response server results in 401 error #65

Closed
kuoyuchi opened this issue Apr 2, 2020 · 7 comments · Fixed by #67
Closed

WCP call to response server results in 401 error #65

kuoyuchi opened this issue Apr 2, 2020 · 7 comments · Fixed by #67
Milestone

Comments

@kuoyuchi
Copy link

kuoyuchi commented Apr 2, 2020

Logs on WCP:
2020-04-02 18:36:17,079 WARN [http-nio-8080-exec-8] (RestTemplate.java:549) - POST request for "http://35.196.119.71:60000/mystudies-response-server/studymetadata" resulted in 401 (null); invoking error handler 2020-04-02 18:36:17,080 ERROR [http-nio-8080-exec-8] (StudyController.java:5160) - StudyController - submitResponseToResponseServer() - ERROR org.springframework.web.client.HttpClientErrorException: 401 null at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:88) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:556) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:514) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:472) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:420) at com.fdahpstudydesigner.controller.StudyController.submitResponseToResponseServer(StudyController.java:5151)

@kuoyuchi
Copy link
Author

kuoyuchi commented Apr 2, 2020

I can't find relevant detailed log for this on response server. Only seeing access log:

Defaulting container name to response-server-ws.
Use 'kubectl describe pod/response-server-ws-6c7dbb5b98-gnnl7 -n default' to see all of the containers in this pod.
10.142.0.5 - - [02/Apr/2020:00:27:27 +0000] "GET /mystudies-response-server/ HTTP/1.1" 401 5
10.60.1.1 - - [02/Apr/2020:01:58:34 +0000] "GET /mystudies-response-server/ HTTP/1.1" 401 5
10.142.0.5 - - [02/Apr/2020:01:58:35 +0000] "GET /mystudies-response-server/ HTTP/1.1" 401 5
10.60.1.1 - - [02/Apr/2020:04:09:37 +0000] "GET / HTTP/1.1" 404 713
10.142.0.5 - - [02/Apr/2020:09:18:35 +0000] "-" 400 1921
10.60.1.1 - - [02/Apr/2020:15:29:48 +0000] "-" 400 1921
10.142.0.7 - - [02/Apr/2020:17:54:35 +0000] "-" 400 1921
10.60.1.1 - - [02/Apr/2020:18:36:17 +0000] "POST /mystudies-response-server/studymetadata HTTP/1.1" 401 5
10.142.0.7 - - [02/Apr/2020:18:40:09 +0000] "GET /mystudies-response-server/studymetadata HTTP/1.1" 401 5
10.142.0.7 - - [02/Apr/2020:18:57:48 +0000] "POST /mystudies-response-server/participant/add HTTP/1.1" 500 174
10.142.0.5 - - [02/Apr/2020:19:02:01 +0000] "POST /mystudies-response-server/participant/get-activity-state HTTP/1.1" 401 5
10.142.0.5 - - [02/Apr/2020:19:02:11 +0000] "POST /mystudies-response-server/participant/get-activity-state HTTP/1.1" 401 5
10.60.1.1 - - [02/Apr/2020:19:03:02 +0000] "POST /mystudies-response-server/participant/get-activity-state HTTP/1.1" 401 5
10.142.0.5 - - [02/Apr/2020:19:03:24 +0000] "GET /mystudies-response-server/studymetadata HTTP/1.1" 401 5
10.142.0.5 - - [02/Apr/2020:19:03:28 +0000] "GET /favicon.ico HTTP/1.1" 404 713
10.142.0.7 - - [02/Apr/2020:19:03:47 +0000] "GET /mystudies-response-server/participant/get-activity-state HTTP/1.1" 401 5
10.142.0.5 - - [02/Apr/2020:19:03:53 +0000] "GET /mystudies-response-server/participant/get-activity-state HTTP/1.1" 401 5
10.142.0.5 - - [02/Apr/2020:19:04:11 +0000] "GET /mystudies-response-server/participant/get-activity-state HTTP/1.1" 401 5
10.142.0.7 - - [02/Apr/2020:19:04:17 +0000] "GET /mystudies-response-server/participant/get-activity-state HTTP/1.1" 401 5
10.142.0.7 - - [02/Apr/2020:19:05:42 +0000] "GET /mystudies-response-server/participant/get-activity-state?participantId=1 HTTP/1.1" 401 5
10.142.0.7 - - [02/Apr/2020:19:08:14 +0000] "GET /mystudies-response-server/participant/get-activity-state?participantId=1 HTTP/1.1" 401 5```

@kuoyuchi
Copy link
Author

kuoyuchi commented Apr 2, 2020

@kuoyuchi
Copy link
Author

kuoyuchi commented Apr 2, 2020

Keeping this open until it's verified end-to-end.

@kuoyuchi kuoyuchi reopened this Apr 2, 2020
@kuoyuchi
Copy link
Author

kuoyuchi commented Apr 2, 2020

Looks like WCPClientId and WCPSecretKey also needs to be in auth_server.client_info table. I'll update WCP for now.
https://github.com/GoogleCloudPlatform/fda-mystudies/blob/early-access/WCP/fdahpStudyDesigner/src/main/java/com/fdahpstudydesigner/controller/StudyController.java#L5141

@kuoyuchi
Copy link
Author

kuoyuchi commented Apr 2, 2020

I created a study on WCP with the changes and I'm getting this error now on WCP:

2020-04-02 23:48:08,856  WARN [http-nio-8080-exec-6] (RestTemplate.java:549) - POST request for "http://35.196.119.71:60000/mystudies-response-server/studymetadata" resulted in 400 (null)
; invoking error handler
2020-04-02 23:48:08,865 ERROR [http-nio-8080-exec-6] (StudyController.java:5160) - StudyController - submitResponseToResponseServer() - ERROR 
org.springframework.web.client.HttpClientErrorException: 400 null

Logs on response server:

2020-04-02 23:48:08.846 ERROR 1 --- [nio-8080-exec-7] c.g.c.h.f.service.CommonServiceImpl      : ERROR: 400
2020-04-02 23:48:08.847 ERROR 1 --- [nio-8080-exec-7] c.g.c.h.f.service.CommonServiceImpl      : Headers: [Access-Control-Allow-Origin:"*", Access-Control-Allow-Headers:"*", Access-Contro
l-Allow-Credentials:"true", Access-Control-Allow-Methods:"GET, POST, PUT, DELETE, OPTIONS, HEAD", status:"401", title:"INVALID_INPUT", StatusMessage:"Invalid input.", Content-Type:"applic
ation/json;charset=UTF-8", Transfer-Encoding:"chunked", Date:"Thu, 02 Apr 2020 23:48:08 GMT", Connection:"close"]
2020-04-02 23:48:08.847 ERROR 1 --- [nio-8080-exec-7] c.g.c.h.f.service.CommonServiceImpl      : Body: {"message":"Invalid input.","code":"400","isValidClient":false}
2020-04-02 23:48:08.848 ERROR 1 --- [nio-8080-exec-7] c.g.c.h.f.service.CommonServiceImpl      : ERROR: 

org.springframework.web.client.HttpClientErrorException$BadRequest: 400 : [{"message":"Invalid input.","code":"400","isValidClient":false}]

Logs on auth server:

2020-04-02T23:48:08.836+0000 INFO AuthenticationFilter doFilter() - starts
2020-04-02T23:48:08.840+0000 INFO AuthenticationController validateClientCredentials() - starts
2020-04-02T23:48:08.840+0000 INFO AuthenticationController validateClientCredentials() - ends with BadRequest
2020-04-02T23:48:08.845+0000 INFO AuthenticationFilter doFilter() - ends

@kuoyuchi
Copy link
Author

kuoyuchi commented Apr 3, 2020

This should be fixed with https://github.com/GoogleCloudPlatform/fda-mystudies/pull/69/files. Pushing the server now.

@kuoyuchi
Copy link
Author

kuoyuchi commented Apr 3, 2020

Created AppTestStudy6 and seeing this in WCP now:

2020-04-03 00:24:28,757  INFO [http-nio-8080-exec-6] (StudyController.java:5154) - StudyController - submitResponseToResponseServer() - INFO ==>> SUCCESS
2020-04-03 00:24:28,757  INFO [http-nio-8080-exec-6] (StudyController.java:5162) - StudyController - submitResponseToResponseServer() - Ends 

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.

2 participants