amplify-js: Upgrading Amplify packages stops remembering Auth session in React Native
Describe the bug
Yesterday I’ve updated my React Native app to the latest version of amazon-cognito-identity-js, @aws-amplify/auth and @aws-amplify/core. Unfortunately after updating the packages my app didn’t remembered the Cognito session anymore after killing the app (so swiping it up on iOS).
It happens on both development and production mode.
@aws-amplify/authfrom 1.4.2 to 1.5.0@aws-amplify/corefrom 1.2.2 to 1.2.4amazon-cognito-identity-jsfrom 3.1.2 to 3.2.0
I’d read the change log and commit messages of both packages, but couldn’t find anything that might be related to the issue. Is this a known bug, or did I miss anything in the change log?
Environment
``` System: OS: macOS 10.15.1 CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz Memory: 50.67 MB / 8.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node Yarn: 1.10.1 - /usr/local/bin/yarn npm: 6.12.0 - ~/.nvm/versions/node/v12.13.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Browsers: Chrome: 78.0.3904.97 Firefox: 70.0 Safari: 13.0.3 npmGlobalPackages: npm: 6.12.0 react-native-cli: 2.0.1```Smartphone (please complete the following information):
- Device: iPhoneX
- OS: 13.1.3
Sample code
After I’ve re-opened the app I run Auth.currentAuthenticatedUser() on componentDidMount, which returns a “not authenticated”.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (4 by maintainers)
Could you delete your node_modules and do:
Let us know if this resolves your issue. We will add the fix to @latest early next week.
@Ashish-Nanda Confirmed that it works again after updating to
@aws-amplify/auth@nextand@aws-amplify/core@nextwithout adding the custom storage helper, suggested in https://github.com/aws-amplify/amplify-js/issues/4351 and the AWS docs. Both running2.1.0now. Any idea when this will get stable?@davidbiller Got it, I used the answer from this issue, after the adding storage to amplify config it started work correctly,
https://github.com/aws-amplify/amplify-js/pull/3991