frontend react application giving error while calling api gateway if the page is kept idle for some time

0

i have created a business application using react and cognito for login. My logic are created in lambda functions and are called by the app through api gateway using aws iam authentication by using identity pool. So when i first open my application it gives an error and cannot call lambda function. after reloading it works fine but if the page is kept idle for long and i called a lambda function it gives an error which get resolve on refresh. My question is that does anyone know why this is happening and is there a way to fix it

2개 답변
1

Without knowing what type of error is being received (i.e. is it a 401? Is it a 403? Is it a 50x?) or having any logs to review, I'll venture a guess as to what might be causing this: You would get behavior similar to this if your Cognito token expired and was not refreshed. Generally, what you can do to alleviate this is use the refresh token to "refresh" your token when the page is idle. You can find information on how to do that programmatically here. In addition -- make sure your authentication flow is not just checking if the token is present in your browser (in a cookie, for instance) but also that it is not expired -- and if it is expired force your users to re-authenticate.

profile pictureAWS
답변함 일 년 전
0

Hi there,

I'd encourage you to retry this operation again. I'm not sure which region, or the full list of services you're using, but want to ensure you're aware of some earlier service impact that could have possibly contributed.

While signed in to your AWS account, please check go.aws/aws-hd to see if a service you're using was affected. The increased error rates in our US West (Oregon) region have now been marked as Resolved. If you continue to encounter errors not mentioned on our Health Dashboard status, please do add additional details on this thread.

Thank you!

— Brian D.

profile pictureAWS
전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠