awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
921 stars 266 forks source link

deepdish:connect errors with token expiry. #755

Open saeelparsekar-aa opened 1 year ago

saeelparsekar-aa commented 1 year ago

Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the official AWS AppSync forum

Bug

We have a app which has its subscriptions through appsync library version ^4.1.9. It has a authentication mechanism set to AWS Lambda. so it basically uses the Access Token from session storage of the web app. We renew the token every 1 hour so basically UI always have the valid token in session storage. However we see a sudden logs in the backend where appsync sends a expired token in a method called deepdish:connect. This token is not the latest one and hence a error is logged as expired token. However after this one fail next request which goes it passes successfully as the expired token is dumped and new token is taken.

We expect that everytime the library internally tris to connect or make a deepdish:connect call, it should use the latest token rather than expired one. We have that available in sessionStorage all the time