amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Auth session is lost after upgrading to v4

Open tien opened this issue 4 years ago • 4 comments

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Categories

auth

Environment information

# Put output below this line

  System:
    OS: macOS 11.4
    CPU: (8) arm64 Apple M1
    Memory: 149.28 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.4.2 - /opt/homebrew/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.19.1 - /opt/homebrew/bin/npm
    Watchman: 2021.06.07.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 91.0.4472.114
    Firefox Developer Edition: 90.0
    Firefox Nightly: 86.0a1
    Safari: 14.1.1
  npmPackages:
    @apollo/client: ^3.3.20 => 3.3.20 
    @apollo/client/cache:  undefined ()
    @apollo/client/core:  undefined ()
    @apollo/client/errors:  undefined ()
    @apollo/client/link/batch:  undefined ()
    @apollo/client/link/batch-http:  undefined ()
    @apollo/client/link/context:  undefined ()
    @apollo/client/link/core:  undefined ()
    @apollo/client/link/error:  undefined ()
    @apollo/client/link/http:  undefined ()
    @apollo/client/link/persisted-queries:  undefined ()
    @apollo/client/link/retry:  undefined ()
    @apollo/client/link/schema:  undefined ()
    @apollo/client/link/utils:  undefined ()
    @apollo/client/link/ws:  undefined ()
    @apollo/client/react:  undefined ()
    @apollo/client/react/components:  undefined ()
    @apollo/client/react/context:  undefined ()
    @apollo/client/react/data:  undefined ()
    @apollo/client/react/hoc:  undefined ()
    @apollo/client/react/hooks:  undefined ()
    @apollo/client/react/parser:  undefined ()
    @apollo/client/react/ssr:  undefined ()
    @apollo/client/testing:  undefined ()
    @apollo/client/utilities:  undefined ()
    @babel/core: ^7.12.9 => 7.13.10 (7.9.0, 7.14.0)
    @babel/runtime: ^7.12.5 => 7.12.5 (7.9.2, 7.14.0)
    @commitlint/cli: ^12.1.4 => 12.1.4 
    @commitlint/config-conventional: ^12.1.4 => 12.1.4 
    @expo/react-native-action-sheet: ^3.8.0 => 3.8.0 
    @graphql-codegen/cli: ^1.21.5 => 1.21.5 
    @graphql-codegen/fragment-matcher: ^2.0.1 => 2.0.1 
    @graphql-codegen/typescript: ^1.22.1 => 1.22.1 
    @graphql-codegen/typescript-apollo-client-helpers: ^1.1.8 => 1.1.8 
    @graphql-codegen/typescript-operations: ^1.18.0 => 1.18.0 
    @react-native-async-storage/async-storage: ^1.15.5 => 1.15.5 (1.14.1)
    @react-native-community/blur: ^3.6.0 => 3.6.0 
    @react-native-community/datetimepicker: ^3.5.2 => 3.5.2 
    @react-native-community/eslint-config: ^2.0.0 => 2.0.0 
    @react-native-community/masked-view: ^0.1.11 => 0.1.11 
    @react-native-community/netinfo: ^6.0.0 => 6.0.0 
    @react-native-firebase/app: ^11.5.0 => 11.5.0 
    @react-native-firebase/crashlytics: ^11.5.0 => 11.5.0 
    @react-native-firebase/perf: ^11.5.0 => 11.5.0 
    @react-native-picker/picker: ^1.16.1 => 1.16.1 
    @react-navigation/bottom-tabs: ^5.11.10 => 5.11.10 
    @react-navigation/elements: ^1.0.0-next.0 => 1.0.0-next.0 
    @react-navigation/native: ^5.9.4 => 5.9.4 
    @react-navigation/stack: ^5.14.4 => 5.14.4 
    @reduxjs/toolkit: ^1.5.1 => 1.5.1 
    @segment/analytics-react-native: ^1.4.8 => 1.4.8 
    @segment/analytics-react-native-firebase: ^1.4.8 => 1.4.8 
    @storybook/addon-actions: ^5.3.21 => 5.3.21 
    @storybook/addon-centered: ^5.3.21 => 5.3.21 
    @storybook/addon-knobs: ^6.1.11 => 6.1.11 
    @storybook/addon-ondevice-actions: ^5.3.23 => 5.3.23 
    @storybook/addon-ondevice-knobs: ^5.3.23 => 5.3.23 
    @storybook/react-native: ^5.3.23 => 5.3.23 
    @storybook/react-native-server: ^5.3.23 => 5.3.23 
    @types/base-64: ^0.1.3 => 0.1.3 
    @types/jest: ^26.0.19 => 26.0.19 
    @types/lodash: ^4.14.168 => 4.14.168 
    @types/ramda: ^0.27.40 => 0.27.40 
    @types/react: ^17.0.0 => 17.0.0 
    @types/react-instantsearch-native: ^6.3.1 => 6.3.1 
    @types/react-native: ^0.63.50 => 0.63.50 
    @types/react-native-video: ^5.0.4 => 5.0.4 
    @types/react-test-renderer: ^17.0.0 => 17.0.0 
    @types/styled-components: ^5.1.9 => 5.1.9 (5.1.7)
    @types/styled-components-react-native: ^5.1.1 => 5.1.1 
    @types/validator: ^13.1.3 => 13.1.3 
    Example:  0.0.1 
    HelloWorld:  0.0.1 
    algoliasearch: ^4.8.6 => 4.8.6 
    amazon-cognito-identity-js: ^5.0.3 => 5.0.3 (4.6.3)
    apollo-link-prismic: ^1.0.8 => 1.0.8 
    aws-amplify: ^3.0.5 => 3.4.3 
    aws-appsync-auth-link: ^3.0.4 => 3.0.4 
    aws-appsync-subscription-link: ^3.0.6 => 3.0.6 
    babel-jest: ^26.6.3 => 26.6.3 
    babel-loader: ^8.2.2 => 8.2.2 
    babel-plugin-graphql-tag: ^3.2.0 => 3.2.0 
    babel-plugin-import-graphql: ^2.8.1 => 2.8.1 
    base-64: ^1.0.0 => 1.0.0 (0.1.0)
    copilot-example:  0.1.0 
    decompress-tarbz2: ^4.1.1 => 4.1.1 
    enzyme: ^3.11.0 => 3.11.0 
    enzyme-adapter-react-16: ^1.15.6 => 1.15.6 
    enzyme-to-json: ^3.6.1 => 3.6.1 
    eslint: ^7.23.0 => 7.23.0 
    eslint-plugin-prettier: ^3.4.0 => 3.4.0 (3.1.2)
    graphql: ^15.5.0 => 15.5.0 (14.0.0, 14.7.0)
    graphql-subscriptions: ^0.5.8 => 0.5.8 
    graphql-tag: ^2.10.1 => 2.10.3 (2.12.4, 2.11.0)
    hermes-inspector-msggen:  1.0.0 
    husky: ^6.0.0 => 6.0.0 
    jasmine: ^3.4.0 => 3.5.0 
    jest: ^26.6.3 => 26.6.3 
    jest-extended: ^0.11.5 => 0.11.5 
    jetifier: ^1.6.4 => 1.6.5 
    jsdom-global: ^3.0.2 => 3.0.2 
    jwt-decode: ^3.1.2 => 3.1.2 
    metro-react-native-babel-preset: ^0.64.0 => 0.64.0 
    mockdate: ^2.0.5 => 2.0.5 (3.0.5)
    moment: ^2.24.0 => 2.24.0 
    patch-package: ^6.4.7 => 6.4.7 
    postinstall-postinstall: ^2.1.0 => 2.1.0 
    prettier: ^2.3.1 => 2.3.1 (2.2.1)
    prop-types: ^15.7.2 => 15.7.2 
    qs: ^6.10.1 => 6.10.1 (6.9.4, 6.7.0, 6.5.2)
    react: 17.0.1 => 17.0.1 (16.14.0)
    react-airplay: ^1.0.0 => 1.0.0 
    react-dom: ^16.9.0 => 16.13.1 (16.14.0)
    react-hook-form: ^7.8.1 => 7.8.1 
    react-instantsearch-native: ^6.10.3 => 6.10.3 
    react-native: 0.64.2 => 0.64.2 
    react-native-airplay-btn: ^1.1.0 => 1.1.0 
    react-native-airplay-menu: ^1.0.13 => 1.0.13 
    react-native-animatable: ^1.3.3 => 1.3.3 
    react-native-config: ^0.12.0 => 0.12.0 
    react-native-copilot: https://github.com/quyentran-agilityio/react-native-copilot.git => 2.4.4 
    react-native-device-info: ^5.4.0 => 5.5.5 
    react-native-exit-app: ^1.1.0 => 1.1.0 
    react-native-fast-image: ^8.3.4 => 8.3.4 
    react-native-flipper: ^0.84.0 => 0.84.0 (0.34.0)
    react-native-gesture-handler: ^1.10.3 => 1.10.3 
    react-native-google-cast: ^4.0.3 => 4.1.2 
    react-native-iphone-x-helper: ^1.2.1 => 1.2.1 (1.3.1)
    react-native-keyboard-aware-scroll-view: ^0.9.4 => 0.9.4 
    react-native-linear-gradient: ^2.5.6 => 2.5.6 
    react-native-localize: ^1.3.3 => 1.4.0 
    react-native-modal: ^11.7.0 => 11.7.0 (11.6.1)
    react-native-modal-datetime-picker: ^10.0.0 => 10.0.0 (7.6.1)
    react-native-notifications: ^3.1.2 => 3.1.4 
    react-native-orientation-locker: ^1.1.6 => 1.1.8 
    react-native-pager-view: ^5.1.2 => 5.1.2 
    react-native-reanimated: ^2.2.0 => 2.2.0 
    react-native-safe-area-context: ^3.2.0 => 3.2.0 
    react-native-safe-area-view: ^1.1.1 => 1.1.1 
    react-native-screens: ^3.3.0 => 3.3.0 
    react-native-sentry: ^0.43.2 => 0.43.2 
    react-native-storybook-loader: ^2.0.2 => 2.0.2 
    react-native-svg: ^9.7.1 => 9.13.6 
    react-native-system-setting: ^1.7.2 => 1.7.4 
    react-native-tab-view: ^2.10.0 => 2.14.0 
    react-native-text-ticker: ^1.12.0 => 1.12.0 
    react-native-video: ^5.1.1 => 5.1.1 
    react-native-video-cache: ^2.0.5 => 2.0.5 
    react-redux: ^7.2.4 => 7.2.4 
    react-test-renderer: 17.0.1 => 17.0.1 (16.13.1)
    reactotron-react-native: ^5.0.0 => 5.0.0 
    reactotron-redux: ^3.1.3 => 3.1.3 
    reactotron-redux-saga: ^4.2.3 => 4.2.3 
    recent-searches: tien/recent-searches => 1.0.3 
    recompose: ^0.30.0 => 0.30.0 
    redux-persist: ^6.0.0 => 6.0.0 
    redux-persist/integration/react:  undefined ()
    redux-saga: ^1.1.3 => 1.1.3 
    redux-saga/effects:  undefined ()
    rn-fetch-blob: https://github.com/quyentran-agilityio/rn-fetch-blob.git => 0.10.16 
    rn-placeholder: ^3.0.3 => 3.0.3 
    shallow-with-context: ^0.4.1 => 0.4.1 
    styled-components: ^4.3.2 => 4.4.1 
    styled-components/macro:  undefined ()
    styled-components/native:  undefined ()
    styled-components/primitives:  undefined ()
    styled-theming: ^2.2.0 => 2.2.0 
    typescript: ^4.3.2 => 4.3.2 
    validator: ^13.6.0 => 13.6.0 
  npmGlobalPackages:
    @angular/cli: 12.1.1
    npm: 7.19.1
    react-devtools: 4.11.0
    source-map-cli: 1.0.0

Describe the bug

After upgrading to amplify v4, the previously authenticated session is lost: Auth.currentAuthenticatedUser, Auth.currentSession, etc all throwing no user error. Downgrading to v3 or v2 will have the user logged in again, I've inspected AsyncStorage and can see that the auth session is persisted correctly & is not lost after upgrading.

Expected behavior

Authenticated users should still be valid after upgrading to v4

Reproduction steps

  • Install aws-amplify v3
  • Log a user in using Auth.signIn
  • Upgrade to aws-amplify v4
  • The session is no longer valid

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

tien avatar Jul 08 '21 22:07 tien

we faced the very same issue mainly on iOS. Don't know if that can be helpful for debugging this issue

ifero avatar Jul 09 '21 10:07 ifero

Are there any updates on this issue?

alesmit avatar Sep 07 '22 14:09 alesmit

Hi 👋 @alesmit, I'm looking into it now

tannerabread avatar Sep 08 '22 12:09 tannerabread

@alesmit I am having trouble recreating this issue, do you have any further details outside of what is listed in the original post?

I made a sample app with v3 and then logged in, checked auth, upgraded to v4 and installed the required dependencies that come with the breaking changes in v4, and my session was still active/valid

Let me know if there is some other way you are approaching this issue so I can try to recreate

tannerabread avatar Sep 08 '22 22:09 tannerabread

@alesmit Are you still having problems with this?

tannerabread avatar Oct 06 '22 13:10 tannerabread

Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you.

Thank you!

tannerabread avatar Oct 10 '22 14:10 tannerabread