avniproject / integration-service

Service for integration Avni with other systems
GNU Affero General Public License v3.0
0 stars 2 forks source link

Bugsnag issue - Auth issue with Goonj integration #104

Closed vinayvenu closed 11 months ago

vinayvenu commented 11 months ago

https://app.bugsnag.com/samanvay-research-and-development-foundation/avni-int/errors/65573298ded28d00087a3c54?event_id=6558d17100cd0b67a9820000&i=em&m=fq&pivot_tab=event

org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: "{"error":"invalid_grant","error_description":"authentication failure"}"
        at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:101)
        at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:168)
        at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)
        at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
        at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:819)
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:777)
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:751)
        at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:486)
        at org.avni_integration_service.goonj.service.TokenService.loginWithCredentials(TokenService.java:66)
        at org.avni_integration_service.goonj.service.TokenService.getRefreshedToken(TokenService.java:44)
        at org.avni_integration_service.goonj.config.GoonjSpringConfig.lambda$restTemplate$0(GoonjSpringConfig.java:32)
        at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:93)
        at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:77)
        at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
        at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:66)
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:776)
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:751)
        at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:621)
        at org.avni_integration_service.goonj.repository.GoonjBaseRepository.getResponse(GoonjBaseRepository.java:52)
        at org.avni_integration_service.goonj.repository.InventoryRepository.getInventoryItemsDTOS(InventoryRepository.java:46)
        at org.avni_integration_service.goonj.repository.InventoryRepository.fetchDeletionEvents(InventoryRepository.java:32)
        at org.avni_integration_service.goonj.worker.goonj.BaseGoonjWorker.fetchDeletionEvents(BaseGoonjWorker.java:30)
        at org.avni_integration_service.goonj.worker.goonj.InventoryWorker.processDeletions(InventoryWorker.java:30)
        at org.avni_integration_service.goonj.job.AvniGoonjMainJob.processInventory(AvniGoonjMainJob.java:169)
        at org.avni_integration_service.goonj.job.AvniGoonjMainJob.execute(AvniGoonjMainJob.java:78)
        at org.avni_integration_service.scheduler.IntegrationJobScheduler.lambda$scheduleAll$0(IntegrationJobScheduler.java:81)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
        at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:95)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.lang.Thread.run(Thread.java:833)
ashusvnath commented 11 months ago

Found some information here https://developer.salesforce.com/forums/?id=906F000000099liIAA and here https://salesforce.stackexchange.com/questions/339872/errorinvalid-grant-error-descriptionauthentication-failure

ashusvnath commented 11 months ago

It looks like the error has stopped occurring after

2023-11-20 08:00:07,197 ERROR SpringTaskScheduler-4 [goonj.job.AvniGoonjMainJob] Failed processInventory
org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: "{"error":"invalid_grant","error_description":"authentication failure"}"
    at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:101)
ashusvnath commented 11 months ago

Since the exceptions stopped occurring at ~8 AM UTC 20th Nov 2023, this bug is rejected.