jhipster / jhipster-online

JHipster Online lets you generate your JHipster projects through a user friendly web interface.
https://start.jhipster.tech/
Apache License 2.0
206 stars 139 forks source link

GitHub and GitLab Configuration Failure #200

Closed mydiemho closed 4 years ago

mydiemho commented 4 years ago

After configure JHipster to access my GitHub account, I keep seeing the error JHipster has failed to reach your Github repositories.. When I checked on GitHub, I can see that JHipster is in the Authorized OAuth Apps list.

Screen Shot 2020-07-24 at 17 01 28

Screen Shot 2020-07-24 at 17 01 50

SudharakaP commented 4 years ago

@mydiemho : Thanks for reporting this. I was able to reproduce this. Although the JHipster app is authorized properly it shows this error it seems. Will take a look. :thinking:

SudharakaP commented 4 years ago

Just for the information; as pointed out in this comment; https://github.com/jhipster/jhipster-online/issues/93#issuecomment-663868193, this also applies to GitLab.

vishal423 commented 4 years ago

@SudharakaP, what error do you see in server logs?

SudharakaP commented 4 years ago

@vishal423 : The error is,

Server Log ``` A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found: [{"error":"Not Found"}] A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:113) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:170) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:112) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:782) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:740) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:674) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:449) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at io.github.jhipster.online.web.rest.GitResource.saveToken(GitResource.java:126) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at io.github.jhipster.online.web.rest.GitResource$$FastClassBySpringCGLIB$$ca87e103.invoke() A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) A 2020-07-25T05:57:49Z Jul 25 05:57:49 jhipster-app jhonline.war[11687]: #011at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ```

Seems like something to do with CORS. :thinking:

vishal423 commented 4 years ago

I did a quick check on local setup, and able to configure GitHub without any issues or additional configurations. Have you tried on local setup to reproduce the issue?

SudharakaP commented 4 years ago

I did a quick check on local setup, and able to configure GitHub without any issues or additional configurations. Have you tried on local setup to reproduce the issue?

@vishal423 : That's strange. I created my own OAuth App and OAuth Token and tested it on local and I could recreate this exact scenario. Even the error is the same. :wink: :thinking: :thinking:

vishal423 commented 4 years ago

image

SudharakaP commented 4 years ago

@vishal423 : Hmm.... :thinking: :thinking: Kinda confusing why this happens on some machines,

Screenshot from 2020-07-25 12-40-37

SudharakaP commented 4 years ago

@vishal423 : can you try running the prod profile and see if it works? :thinking:

Because I have a feeling that since dev profile has all CORS enabled that might be why it's working. I'll try the dev profile as well in a minute; need to take a break. :smile:

SudharakaP commented 4 years ago

@vishal423 : For me it fails for dev as well. :disappointed:

SudharakaP commented 4 years ago

It seems to me that this intermittent issue of Git Sync on both GitHub and GitLab comes from way we send the POST request to the Git provider using the RestTemplate library. I cannot pinpoint why it fails only for some people but I felt that its something to do with the library itself so I changed it to the more recent HttpClient of Java 11. And thus the project was also upgraded to Java 11. Please take a look and let me know if you see any issues; I tested this on my side several times to make sure and seems everything works fine, but given that it wasn't working for some people I would appreciate if you can test it on your end as well if the sync is working as expected. :smile:

cc: @vishal423

SudharakaP commented 4 years ago

@mydiemho : I just released v2.6.4 which includes the fix for this. If you even encounter this issue again please feel free to let us know. :smile:

cc: @tonsV2

Thanks both of you for reporting this issue. :smile:

devysf commented 1 year ago

Hi, I am encountering this problem.

image

Additionally, although I receive access tokens on GitHub, I cannot list or select repositories.

image