aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

TypeError: Cannot read property 'operation' of undefined #11722

Closed mhyassin closed 11 months ago

mhyassin commented 1 year ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication, Analytics, GraphQL API, DataStore, Storage

Amplify Categories

No response

Environment information

``` # Put output below this line System: OS: macOS 13.4.1 CPU: (10) arm64 Apple M1 Pro Memory: 99.52 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.3.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.6.7 - /opt/homebrew/bin/npm Watchman: 2023.06.12.00 - /opt/homebrew/bin/watchman Browsers: Chrome: 115.0.5790.170 Firefox: 115.0.3 Safari: 16.5.2 npmPackages: @babel/core: ^7.20.0 => 7.21.3 (7.22.8, 7.18.13) @babel/eslint-parser: ^7.18.2 => 7.18.9 @babel/preset-env: ^7.20.0 => 7.20.2 (7.22.7) @babel/runtime: ^7.20.0 => 7.21.0 (7.18.9, 7.19.0) @commitlint/cli: ^17.0.3 => 17.0.3 @commitlint/config-conventional: ^17.0.3 => 17.0.3 @georstat/react-native-image-cache: 2.7.0 => 2.7.0 @react-native-async-storage/async-storage: 1.19.1 => 1.19.1 @react-native-clipboard/clipboard: 1.10.0 => 1.10.0 @react-native-community/datetimepicker: 6.1.3 => 6.1.3 @react-native-community/eslint-config: ^3.2.0 => 3.2.0 @react-native-community/eslint-plugin: ^1.3.0 => 1.3.0 (1.2.0) @react-native-community/netinfo: 9.4.1 => 9.4.1 @react-native-firebase/app: 15.7.0 => 15.7.0 @react-native-firebase/messaging: 15.7.0 => 15.7.0 @react-native-picker/picker: 2.4.1 => 2.4.1 (1.16.8) @react-navigation/bottom-tabs: 6.3.1 => 6.3.1 @react-navigation/elements: 1.3.17 => 1.3.17 (1.3.4, 1.3.9) @react-navigation/native: 6.0.16 => 6.0.16 @react-navigation/native-stack: 6.9.4 => 6.9.4 @react-navigation/stack: 6.2.2 => 6.2.2 @sentry/react-native: 5.1.1 => 5.1.1 @tsconfig/react-native: ^3.0.2 => 3.0.2 @types/d3-scale: 4.0.3 => 4.0.3 @types/jest: ^29.5.2 => 29.5.2 @types/lodash: 4.14.185 => 4.14.185 @types/react: 18.0.24 => 18.0.24 (18.0.17) @types/react-native-autocomplete-input: ^5.1.1 => 5.1.1 @types/react-native-vector-icons: 6.4.11 => 6.4.11 @types/react-native-version-check: 3.4.5 => 3.4.5 @types/react-test-renderer: 18.0.0 => 18.0.0 @typescript-eslint/eslint-plugin: ^5.61.0 => 5.61.0 (5.34.0) @typescript-eslint/parser: ^5.61.0 => 5.61.0 (5.34.0) HelloWorld: 0.0.1 amazon-cognito-identity-js: 6.3.1 => 6.3.1 amazon-cognito-identity-js/internals: undefined () aws-amplify: 5.3.6 => 5.3.6 axios: 0.27.2 => 0.27.2 (0.26.0) babel-jest: ^29.2.1 => 29.5.0 babel-plugin-module-resolver: 4.1.0 => 4.1.0 core-js: 3.30.2 => 3.30.2 crypto-js: 4.1.1 => 4.1.1 d3: 7.4.4 => 7.4.4 d3-array: 3.1.6 => 3.1.6 (3.2.0) d3-scale: 4.0.2 => 4.0.2 d3-shape: 3.1.0 => 3.1.0 date-fns: 2.28.0 => 2.28.0 eslint: ^8.21.0 => 8.22.0 eslint-config-prettier: 8.5.0 => 8.5.0 eslint-plugin-jest: ^26.8.2 => 26.8.7 fs-extra: ^10.1.0 => 10.1.0 (8.1.0, 11.1.1) graphql: 15.7.0 => 15.7.0 (15.8.0) husky: 8.0.1 => 8.0.1 i18next: 21.8.10 => 21.8.10 jest: ^29.2.1 => 29.5.0 jest-environment-jsdom: ^29.5.0 => 29.5.0 jest-transform-stub: 2.0.0 => 2.0.0 lint-staged: ^13.2.3 => 13.2.3 lodash-es: ^4.17.21 => 4.17.21 lottie-react-native: 5.1.4 => 5.1.4 metro-react-native-babel-preset: 0.73.9 => 0.73.9 moment: 2.29.4 => 2.29.4 polished: 4.2.2 => 4.2.2 prettier: 2.8.8 => 2.8.8 react: 18.2.0 => 18.2.0 react-i18next: 11.18.3 => 11.18.3 react-native: 0.71.7 => 0.71.7 react-native-appsflyer: 6.10.2 => 6.10.2 react-native-autocomplete-input: 5.2.0 => 5.2.0 react-native-bootsplash: 4.6.0 => 4.6.0 react-native-config: 1.4.6 => 1.4.6 react-native-email-link: 1.14.1 => 1.14.1 react-native-file-access: 3.0.4 => 3.0.4 react-native-gesture-handler: 2.12.0 => 2.12.0 react-native-image-crop-picker: 0.39.0 => 0.39.0 react-native-inappbrowser-reborn: 3.7.0 => 3.7.0 react-native-keyboard-aware-scroll-view: 0.9.5 => 0.9.5 react-native-linear-gradient: 2.6.2 => 2.6.2 react-native-localize: 2.2.4 => 2.2.4 react-native-picker-select: 8.0.4 => 8.0.4 react-native-purchases: 5.2.2 => 5.2.2 react-native-reanimated: 3.3.0 => 3.3.0 react-native-reanimated-carousel: 3.3.2 => 3.3.2 react-native-safe-area-context: 4.4.1 => 4.4.1 react-native-screens: 3.18.2 => 3.18.2 react-native-shared-element: 0.8.4 => 0.8.4 react-native-snackbar: 2.4.0 => 2.4.0 react-native-svg: 12.4.4 => 12.4.4 react-native-svg-transformer: 1.0.0 => 1.0.0 react-native-toast-message: 2.1.5 => 2.1.5 react-native-track-player: 2.1.3 => 2.1.3 react-native-vector-icons: 9.2.0 => 9.2.0 react-native-version-check: 3.4.7 => 3.4.7 react-native-webview: 11.22.2 => 11.22.2 react-navigation-shared-element: 3.1.3 => 3.1.3 react-test-renderer: 18.2.0 => 18.2.0 styled-components: 6.0.4 => 6.0.4 styled-components/macro: undefined () styled-components/native: undefined () terra-react: 1.4.18 => 1.4.18 tiny-timer: 1.6.0 => 1.6.0 ts-jest: ^29.1.1 => 29.1.1 ts-node: ^10.9.1 => 10.9.1 typescript: ^4.9.5 => 4.9.5 (4.7.4) zustand: 4.3.6 => 4.3.6 npmGlobalPackages: @sentry/wizard: 2.2.1 create-react-native-app: 3.8.0 ios-deploy: 1.11.4 npm: 9.6.7 react-devtools: 4.25.0 ts-node: 10.9.1 vercel: 27.2.0 yarn: 1.22.19 ```

Describe the bug

We call DataStore.clear() while the user is signing out and some times after calling await DataStore.clear() I get this type error, not sure if it affects anything though

Expected behavior

The promise rejection is handled correctly

Reproduction steps

  1. Just randomly call DataStore.clear()

Code Snippet

// Put your code below this line.

const signout = async () => {
  await DataStore.stop();
  await DataStore.clear();
  try {
    await Auth.signOut();
  } catch (err) {
    ...
  }
};

Log output

``` // Put your logs below this line WARN Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property 'operation' of undefined TypeError: Cannot read property 'operation' of undefined at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:230333:23) at call (native) at step (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:133300:27) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:133248:22) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:133222:75) at tryCallTwo (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:61:9) at doResolve (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:216:25) at Promise (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:82:14) at __awaiter (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:133204:38) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:230327:68) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:230256:58) at call (native) at step (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:133300:27) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:133248:22) at fulfilled (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:133207:32) at tryCallOne (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:53:16) at anonymous (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:139:27) at apply (native) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:26457:26) at _callTimer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:26376:17) at _callReactNativeMicrotasksPass (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:26406:17) at callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:26569:44) at __callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:5177:46) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:4989:45) at __guard (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:5161:15) at flushedQueue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:4988:21) at invokeCallbackAndReturnFlushedQueue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=health.onvy.staging:4982:33) ```

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

chrisbonifacio commented 1 year ago

Hi @mhyassin can you run the Amplify CLI command amplify diagnose --send-report and share the project identifier that is output? This will give us some insight into your GraphQL schema and API configuration so we can attempt to reproduce the issue.

Since this error seems to happen intermittently, could you check to see if there are any mutations being sent or pending mutations in the outbox when signing out?

You can try enabling the Amplify logger by adding this line under the Amplify configuration

Amplify.Logger.LOG_LEVEL="DEBUG";

Or you should be able to use the Hub to listen to datastore events and log them to gain some more insight into what it's trying to do during sign out.

Hub Listener

DataStore Events

mhyassin commented 1 year ago

Hi @chrisbonifacio, The project identifier is: 1f41c9d6304e82061193f8ee2e85ae0a

david-mcafee commented 1 year ago

Hi @mhyassin! Were you able to debug with any of @chrisbonifacio's suggestions (i.e. checking for the existence of pending mutations and / or debugging with additional logging)?

mhyassin commented 1 year ago

Hey @david-mcafee, I tried debugging for some time, I'm sharing my findings below,

Here is the full logout leading to the issue

Tap here ### Logs ``` LOG [DEBUG] 43:36.694 Credentials - getting credentials LOG [DEBUG] 43:36.695 Credentials - picking up credentials LOG [DEBUG] 43:36.695 Credentials - getting old cred promise LOG [DEBUG] 43:36.696 Hub - Dispatching to analytics with {"data": {"attributes": {"property": "public_ip"}, "name": "profile.update"}, "event": "record", "message": "Recording Analytics event"} LOG [DEBUG] 43:36.696 AnalyticsClass - on hub capsule analytics {"data": {"attributes": {"property": "public_ip"}, "name": "profile.update"}, "event": "record", "message": "Recording Analytics event"} LOG [DEBUG] 43:36.697 AWSPinpointProvider - _public record {"event": {"attributes": {"property": "public_ip"}, "name": "profile.update"}, "provider": undefined} LOG [DEBUG] 43:36.697 Credentials - getting credentials LOG [DEBUG] 43:36.698 Credentials - picking up credentials LOG [DEBUG] 43:36.699 Credentials - getting old cred promise LOG [DEBUG] 43:36.705 AWSPinpointProvider - set credentials for analytics {"accessKeyId": "", "authenticated": true, "expiration": 2023-08-15T10:43:27.000Z, "identityId": "eu-central-1:47194c2a-65dd-4caa-aaba-10d8bcad79cc", "secretAccessKey": "", "sessionToken": ""} LOG [DEBUG] 43:36.706 AWSPinpointProvider - set credentials for analytics {"accessKeyId": "", "authenticated": true, "expiration": 2023-08-15T10:43:27.000Z, "identityId": "eu-central-1:47194c2a-65dd-4caa-aaba-10d8bcad79cc", "secretAccessKey": "", "sessionToken": ""} LOG [DEBUG] 43:36.707 AWSPinpointProvider - set credentials for analytics {"accessKeyId": "", "authenticated": true, "expiration": 2023-08-15T10:43:27.000Z, "identityId": "eu-central-1:47194c2a-65dd-4caa-aaba-10d8bcad79cc", "secretAccessKey": "", "sessionToken": ""} LOG [DEBUG] 43:36.708 AWSPinpointProvider - set credentials for analytics {"accessKeyId": "", "authenticated": true, "expiration": 2023-08-15T10:43:27.000Z, "identityId": "eu-central-1:47194c2a-65dd-4caa-aaba-10d8bcad79cc", "secretAccessKey": "", "sessionToken": ""} LOG [DEBUG] 43:36.708 AWSPinpointProvider - set credentials for analytics {"accessKeyId": "", "authenticated": true, "expiration": 2023-08-15T10:43:27.000Z, "identityId": "eu-central-1:47194c2a-65dd-4caa-aaba-10d8bcad79cc", "secretAccessKey": "", "sessionToken": ""} LOG [DEBUG] 43:36.709 AWSPinpointProvider - init provider LOG [DEBUG] 43:36.710 AWSPinpointProvider - no change for aws credentials, directly return from init LOG [DEBUG] 43:36.710 AWSPinpointProvider - init provider LOG [DEBUG] 43:36.711 AWSPinpointProvider - no change for aws credentials, directly return from init LOG [DEBUG] 43:36.711 AWSPinpointProvider - init provider LOG [DEBUG] 43:36.712 AWSPinpointProvider - no change for aws credentials, directly return from init LOG [DEBUG] 43:36.712 AWSPinpointProvider - init provider LOG [DEBUG] 43:36.712 AWSPinpointProvider - no change for aws credentials, directly return from init LOG [DEBUG] 43:36.713 AWSPinpointProvider - init provider LOG [DEBUG] 43:36.713 AWSPinpointProvider - no change for aws credentials, directly return from init LOG [DEBUG] 43:37.767 DataStore - Sync successful with authMode: AMAZON_COGNITO_USER_POOLS LOG [DEBUG] 43:37.768 DataStore - Attempting sync with authMode: AMAZON_COGNITO_USER_POOLS LOG [DEBUG] 43:37.768 Util - attempt #1 with this vars: ["query operation($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: ModelScoreFilterInput){\n\t\tsyncScores(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter){\n\t\t\titems {\n\t\t\t\t\t\t\tuser_name\ndate\nmetric\ndata_numbers\ndata_datetimes\ndata_sources\ncreatedAt\nupdatedAt\n_version\n_lastChangedAt\n_deleted\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnextToken\n\t\t\t\t\t\tstartedAt\n\t\t}\n\t}",{"limit":1000,"nextToken":"","lastSync":0,"filter":{"and":[{"user_name":{"eq":"236448d2-9001-7036-bbec-0234424b9b3d"}}]}}] LOG [DEBUG] 43:37.770 AuthClass - Getting current session LOG [DEBUG] 43:37.772 AuthClass - Succeed to get the user session {"accessToken": {"jwtToken": "", "payload": {"auth_time": 1692002346, "client_id": "65nn0jjpl05h9r18oh4sgkf9u6", "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "3bb3e537-83e7-4795-8a69-5906b0a75f3a", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "scope": "aws.cognito.signin.user.admin", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "access", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}}, "clockDrift": 0, "idToken": {"jwtToken": "", "payload": {"aud": "65nn0jjpl05h9r18oh4sgkf9u6", "auth_time": 1692002346, "cognito:username": "236448d2-9001-7036-bbec-0234424b9b3d", "email": "my@test.test", "email_verified": true, "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "18932f88-1a89-4d20-99c0-81629883c7ce", "name": "my@test.test", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "id"}}, "refreshToken": {"token": ""}} LOG [DEBUG] 43:37.775 AuthClass - Succeed to get the user session {"accessToken": {"jwtToken": "", "payload": {"auth_time": 1692002346, "client_id": "65nn0jjpl05h9r18oh4sgkf9u6", "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "3bb3e537-83e7-4795-8a69-5906b0a75f3a", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "scope": "aws.cognito.signin.user.admin", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "access", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}}, "clockDrift": 0, "idToken": {"jwtToken": "", "payload": {"aud": "65nn0jjpl05h9r18oh4sgkf9u6", "auth_time": 1692002346, "cognito:username": "236448d2-9001-7036-bbec-0234424b9b3d", "email": "my@test.test", "email_verified": true, "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "18932f88-1a89-4d20-99c0-81629883c7ce", "name": "my@test.test", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "id"}}, "refreshToken": {"token": ""}} LOG [DEBUG] 43:37.777 RestClient - POST https://ahimr3zb4fgulabuhizhyfr7p4.appsync-api.eu-central-1.amazonaws.com/graphql LOG [DEBUG] 43:39.416 DataStore - Sync successful with authMode: AMAZON_COGNITO_USER_POOLS LOG [DEBUG] 43:39.417 DataStore - Attempting sync with authMode: AMAZON_COGNITO_USER_POOLS LOG [DEBUG] 43:39.417 Util - attempt #1 with this vars: ["query operation($limit: Int, $nextToken: String, $lastSync: AWSTimestamp, $filter: ModelScoreFilterInput){\n\t\tsyncScores(limit: $limit, nextToken: $nextToken, lastSync: $lastSync, filter: $filter){\n\t\t\titems {\n\t\t\t\t\t\t\tuser_name\ndate\nmetric\ndata_numbers\ndata_datetimes\ndata_sources\ncreatedAt\nupdatedAt\n_version\n_lastChangedAt\n_deleted\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnextToken\n\t\t\t\t\t\tstartedAt\n\t\t}\n\t}",{"limit":1000,"nextToken":"","lastSync":0,"filter":{"and":[{"user_name":{"eq":"236448d2-9001-7036-bbec-0234424b9b3d"}}]}}] LOG [DEBUG] 43:39.419 AuthClass - Getting current session LOG [DEBUG] 43:39.421 AuthClass - Succeed to get the user session {"accessToken": {"jwtToken": "", "payload": {"auth_time": 1692002346, "client_id": "65nn0jjpl05h9r18oh4sgkf9u6", "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "3bb3e537-83e7-4795-8a69-5906b0a75f3a", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "scope": "aws.cognito.signin.user.admin", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "access", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}}, "clockDrift": 0, "idToken": {"jwtToken": "", "payload": {"aud": "65nn0jjpl05h9r18oh4sgkf9u6", "auth_time": 1692002346, "cognito:username": "236448d2-9001-7036-bbec-0234424b9b3d", "email": "my@test.test", "email_verified": true, "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "18932f88-1a89-4d20-99c0-81629883c7ce", "name": "my@test.test", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "id"}}, "refreshToken": {"token": ""}} LOG [DEBUG] 43:39.424 AuthClass - Succeed to get the user session {"accessToken": {"jwtToken": "", "payload": {"auth_time": 1692002346, "client_id": "65nn0jjpl05h9r18oh4sgkf9u6", "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "3bb3e537-83e7-4795-8a69-5906b0a75f3a", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "scope": "aws.cognito.signin.user.admin", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "access", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}}, "clockDrift": 0, "idToken": {"jwtToken": "", "payload": {"aud": "65nn0jjpl05h9r18oh4sgkf9u6", "auth_time": 1692002346, "cognito:username": "236448d2-9001-7036-bbec-0234424b9b3d", "email": "my@test.test", "email_verified": true, "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "18932f88-1a89-4d20-99c0-81629883c7ce", "name": "my@test.test", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "id"}}, "refreshToken": {"token": ""}} LOG [DEBUG] 43:39.427 RestClient - POST https://ahimr3zb4fgulabuhizhyfr7p4.appsync-api.eu-central-1.amazonaws.com/graphql LOG [DEBUG] 43:39.559 Hub - Dispatching to analytics with {"data": {"attributes": {"params": "{}"}, "name": "dashboard.profileTab.settings.enterPage"}, "event": "record", "message": "Recording Analytics event"} LOG [DEBUG] 43:39.560 AnalyticsClass - on hub capsule analytics {"data": {"attributes": {"params": "{}"}, "name": "dashboard.profileTab.settings.enterPage"}, "event": "record", "message": "Recording Analytics event"} LOG [DEBUG] 43:39.561 AWSPinpointProvider - _public record {"event": {"attributes": {"params": "{}"}, "name": "dashboard.profileTab.settings.enterPage"}, "provider": undefined} LOG [DEBUG] 43:39.561 Credentials - getting credentials LOG [DEBUG] 43:39.562 Credentials - picking up credentials LOG [DEBUG] 43:39.562 Credentials - getting new cred promise LOG [DEBUG] 43:39.563 Credentials - checking if credentials exists and not expired LOG [DEBUG] 43:39.563 Credentials - are these credentials expired? {"accessKeyId": "", "authenticated": true, "expiration": 2023-08-15T10:43:27.000Z, "identityId": "", "secretAccessKey": "", "sessionToken": ""} LOG [DEBUG] 43:39.564 Credentials - credentials not changed and not expired, directly return LOG [DEBUG] 43:39.568 AWSPinpointProvider - set credentials for analytics {"accessKeyId": "", "authenticated": true, "expiration": 2023-08-15T10:43:27.000Z, "identityId": "", "secretAccessKey": "", "sessionToken": ""} LOG [DEBUG] 43:39.570 AWSPinpointProvider - init provider LOG [DEBUG] 43:39.570 AWSPinpointProvider - no change for aws credentials, directly return from init WARN (ADVICE) View #695 of type RCTView has a shadow set but cannot calculate shadow efficiently. Consider setting a background color to fix this, or apply the shadow to a more specific component. LOG [DEBUG] 43:40.617 DataStore - Sync successful with authMode: AMAZON_COGNITO_USER_POOLS LOG [DEBUG] 43:47.157 DataStore - stopping sync engine LOG [DEBUG] 43:47.163 DataStore - stopping sync processor LOG [DEBUG] 43:47.163 DataStore - sync processor stopped LOG [DEBUG] 43:47.165 DataStore - Next fullSync in NaN seconds. (Invalid Date) LOG [DEBUG] 43:47.274 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"eaf152bb-c620-4d3e-bbb1-0feabb8a971f","type":"complete"} LOG [DEBUG] 43:47.275 AWSAppSyncRealTimeProvider {"id": "eaf152bb-c620-4d3e-bbb1-0feabb8a971f", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.276 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"e779883d-8cef-4467-a704-13fe21a894e8","type":"complete"} LOG [DEBUG] 43:47.276 AWSAppSyncRealTimeProvider {"id": "e779883d-8cef-4467-a704-13fe21a894e8", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.277 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"fd53d113-00de-42b6-88d0-34967d5525a5","type":"complete"} LOG [DEBUG] 43:47.277 AWSAppSyncRealTimeProvider {"id": "fd53d113-00de-42b6-88d0-34967d5525a5", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.281 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"73aa0b63-8f44-495c-b0b1-2f7875f57f5e","type":"complete"} LOG [DEBUG] 43:47.282 AWSAppSyncRealTimeProvider {"id": "73aa0b63-8f44-495c-b0b1-2f7875f57f5e", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.282 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"53a73228-444e-48b7-8c8b-041e9c3cfffe","type":"complete"} LOG [DEBUG] 43:47.283 AWSAppSyncRealTimeProvider {"id": "53a73228-444e-48b7-8c8b-041e9c3cfffe", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.284 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"10129638-5b2b-4f8b-b0d3-71b133644e6d","type":"complete"} LOG [DEBUG] 43:47.284 AWSAppSyncRealTimeProvider {"id": "10129638-5b2b-4f8b-b0d3-71b133644e6d", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.286 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"a4b6c825-2427-464f-b601-3cd749ef58bb","type":"complete"} LOG [DEBUG] 43:47.286 AWSAppSyncRealTimeProvider {"id": "a4b6c825-2427-464f-b601-3cd749ef58bb", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.296 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"6bb08e74-5305-494f-8130-aab896200476","type":"complete"} LOG [DEBUG] 43:47.297 AWSAppSyncRealTimeProvider {"id": "6bb08e74-5305-494f-8130-aab896200476", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.298 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"c67fa182-9eb3-46c8-85db-817bb7401ab6","type":"complete"} LOG [DEBUG] 43:47.298 AWSAppSyncRealTimeProvider {"id": "c67fa182-9eb3-46c8-85db-817bb7401ab6", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.306 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"9deb223f-e712-41cd-ad14-a5e86945342a","type":"complete"} LOG [DEBUG] 43:47.307 AWSAppSyncRealTimeProvider {"id": "9deb223f-e712-41cd-ad14-a5e86945342a", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.308 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"988480bb-6ca0-412c-9400-a23d926bb27f","type":"complete"} LOG [DEBUG] 43:47.308 AWSAppSyncRealTimeProvider {"id": "988480bb-6ca0-412c-9400-a23d926bb27f", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.309 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"c76fdbb2-c561-46f0-b4d1-bb879ff61b95","type":"complete"} LOG [DEBUG] 43:47.310 AWSAppSyncRealTimeProvider {"id": "c76fdbb2-c561-46f0-b4d1-bb879ff61b95", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.311 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"28e6963f-6103-4730-b97c-339945904d16","type":"complete"} LOG [DEBUG] 43:47.311 AWSAppSyncRealTimeProvider {"id": "28e6963f-6103-4730-b97c-339945904d16", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.312 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"748d85d8-27ec-45ee-9fbf-442ee4b3955d","type":"complete"} LOG [DEBUG] 43:47.312 AWSAppSyncRealTimeProvider {"id": "748d85d8-27ec-45ee-9fbf-442ee4b3955d", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.313 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"6ddbb094-d728-4058-8a5e-db995defc2c0","type":"complete"} LOG [DEBUG] 43:47.313 AWSAppSyncRealTimeProvider {"id": "6ddbb094-d728-4058-8a5e-db995defc2c0", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.314 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"48c12c41-6dd8-4c36-bb78-1e6f3fa22a0e","type":"complete"} LOG [DEBUG] 43:47.314 AWSAppSyncRealTimeProvider {"id": "48c12c41-6dd8-4c36-bb78-1e6f3fa22a0e", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.318 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"1b0b53fb-008b-48fe-9b10-65d5eb939bab","type":"complete"} LOG [DEBUG] 43:47.318 AWSAppSyncRealTimeProvider {"id": "1b0b53fb-008b-48fe-9b10-65d5eb939bab", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.319 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"bd09512b-5219-45d1-8afc-05c51d0d5690","type":"complete"} LOG [DEBUG] 43:47.320 AWSAppSyncRealTimeProvider {"id": "bd09512b-5219-45d1-8afc-05c51d0d5690", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.321 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"783f342a-2086-48bf-8d26-39a8f899470b","type":"complete"} LOG [DEBUG] 43:47.321 AWSAppSyncRealTimeProvider {"id": "783f342a-2086-48bf-8d26-39a8f899470b", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.322 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"7f44a913-b6f6-415c-98aa-dac9e59f0350","type":"complete"} LOG [DEBUG] 43:47.322 AWSAppSyncRealTimeProvider {"id": "7f44a913-b6f6-415c-98aa-dac9e59f0350", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.326 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"28ffc3c8-607d-4ba5-9ddb-2f8fafd3c6af","type":"complete"} LOG [DEBUG] 43:47.327 AWSAppSyncRealTimeProvider {"id": "28ffc3c8-607d-4ba5-9ddb-2f8fafd3c6af", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.341 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"2d5e7bbc-6e05-493c-b15e-96167ed6d128","type":"complete"} LOG [DEBUG] 43:47.342 AWSAppSyncRealTimeProvider {"id": "2d5e7bbc-6e05-493c-b15e-96167ed6d128", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.343 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"c70a6a61-bf57-4b50-8ff2-caf9e63c03e3","type":"complete"} LOG [DEBUG] 43:47.343 AWSAppSyncRealTimeProvider {"id": "c70a6a61-bf57-4b50-8ff2-caf9e63c03e3", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.344 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"4504e774-84a4-4d2c-aedd-e165a2b2d5ca","type":"complete"} LOG [DEBUG] 43:47.344 AWSAppSyncRealTimeProvider {"id": "4504e774-84a4-4d2c-aedd-e165a2b2d5ca", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.345 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"23bf6ee8-4d44-4ce2-83c4-c97b5a513273","type":"complete"} LOG [DEBUG] 43:47.346 AWSAppSyncRealTimeProvider {"id": "23bf6ee8-4d44-4ce2-83c4-c97b5a513273", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.346 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"e25d057a-19e0-484b-bdef-5e1496a0560b","type":"complete"} LOG [DEBUG] 43:47.347 AWSAppSyncRealTimeProvider {"id": "e25d057a-19e0-484b-bdef-5e1496a0560b", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.348 AWSAppSyncRealTimeProvider - subscription message from AWS AppSync RealTime: {"id":"48709db9-fb6d-4947-b30d-a54c05b2cae8","type":"complete"} LOG [DEBUG] 43:47.348 AWSAppSyncRealTimeProvider {"id": "48709db9-fb6d-4947-b30d-a54c05b2cae8", "observer": null, "query": "", "variables": {}} LOG [DEBUG] 43:47.683 DataStore - sync engine stopped and ready to restart LOG [DEBUG] 43:47.687 DataStore - Attempting mutation with authMode: AMAZON_COGNITO_USER_POOLS LOG [DEBUG] 43:47.688 Util - attempt #1 with this vars: ["User","Update","{\"last_app_open\":\"2023-08-15T09:43:26.246Z\",\"public_ip\":\"197.222.130.100\",\"user_name\":\"236448d2-9001-7036-bbec-0234424b9b3d\",\"_version\":200,\"_lastChangedAt\":1692092514867,\"_deleted\":null}","{}",null,null,{"data":"{\"last_app_open\":\"2023-08-15T09:43:26.246Z\",\"public_ip\":\"197.222.130.100\",\"user_name\":\"236448d2-9001-7036-bbec-0234424b9b3d\",\"_version\":200,\"_lastChangedAt\":1692092514867,\"_deleted\":null}","modelId":"236448d2-9001-7036-bbec-0234424b9b3d","model":"User","operation":"Update","condition":"{}","id":"01H7W989D3S3D0PYPN8PBNVXSX"}] LOG [DEBUG] 43:47.695 AuthClass - Getting current session LOG [DEBUG] 43:47.697 AuthClass - Succeed to get the user session {"accessToken": {"jwtToken": "", "payload": {"auth_time": 1692002346, "client_id": "65nn0jjpl05h9r18oh4sgkf9u6", "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "3bb3e537-83e7-4795-8a69-5906b0a75f3a", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "scope": "aws.cognito.signin.user.admin", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "access", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}}, "clockDrift": 0, "idToken": {"jwtToken": "", "payload": {"aud": "65nn0jjpl05h9r18oh4sgkf9u6", "auth_time": 1692002346, "cognito:username": "236448d2-9001-7036-bbec-0234424b9b3d", "email": "my@test.test", "email_verified": true, "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "18932f88-1a89-4d20-99c0-81629883c7ce", "name": "my@test.test", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "id"}}, "refreshToken": {"token": ""}} LOG [DEBUG] 43:47.700 AuthClass - Succeed to get the user session {"accessToken": {"jwtToken": "", "payload": {"auth_time": 1692002346, "client_id": "65nn0jjpl05h9r18oh4sgkf9u6", "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "3bb3e537-83e7-4795-8a69-5906b0a75f3a", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "scope": "aws.cognito.signin.user.admin", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "access", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}}, "clockDrift": 0, "idToken": {"jwtToken": "", "payload": {"aud": "65nn0jjpl05h9r18oh4sgkf9u6", "auth_time": 1692002346, "cognito:username": "236448d2-9001-7036-bbec-0234424b9b3d", "email": "my@test.test", "email_verified": true, "event_id": "ddc08222-7a62-4800-b9ea-bab29ad27d23", "exp": 1692096104, "iat": 1692092504, "iss": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1_647mHYjCN", "jti": "18932f88-1a89-4d20-99c0-81629883c7ce", "name": "my@test.test", "origin_jti": "d3b6cbbd-9f56-4697-98f6-3a2fe6d35d37", "sub": "236448d2-9001-7036-bbec-0234424b9b3d", "token_use": "id"}}, "refreshToken": {"token": ""}} LOG [DEBUG] 43:47.703 RestClient - POST https://ahimr3zb4fgulabuhizhyfr7p4.appsync-api.eu-central-1.amazonaws.com/graphql LOG [DEBUG] 43:47.806 Credentials - removing aws-amplify-federatedInfo from storage LOG [DEBUG] 43:47.808 AuthClass - user sign out {"Session": null, "authenticationFlowType": "USER_SRP_AUTH", "client": {"endpoint": "https://cognito-idp.eu-central-1.amazonaws.com/", "fetchOptions": {}}, "keyPrefix": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6", "pool": {"advancedSecurityDataCollectionFlag": true, "client": {"endpoint": "https://cognito-idp.eu-central-1.amazonaws.com/", "fetchOptions": [Object]}, "clientId": "65nn0jjpl05h9r18oh4sgkf9u6", "storage": [Function MemoryStorage], "userPoolId": "eu-central-1_647mHYjCN", "wrapRefreshSessionCallback": [Function anonymous]}, "signInUserSession": null, "storage": [Function MemoryStorage], "userDataKey": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6.236448d2-9001-7036-bbec-0234424b9b3d.userData", "username": "236448d2-9001-7036-bbec-0234424b9b3d"} LOG [DEBUG] 43:47.989 DataStore - Mutation sent successfully with authMode: AMAZON_COGNITO_USER_POOLS LOG [DEBUG] 43:47.990 DataStore - Starting Storage WARN Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property 'operation' of undefined TypeError: Cannot read property 'operation' of undefined at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:237419:23) at call (native) at step (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:133314:27) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:133262:22) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:133236:75) at tryCallTwo (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:61:9) at doResolve (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:216:25) at Promise (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:82:14) at __awaiter (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:133218:38) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:237413:68) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:237342:58) at call (native) at step (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:133314:27) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:133262:22) at fulfilled (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:133221:32) at tryCallOne (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:53:16) at anonymous (/Users/distiller/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:139:27) at apply (native) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:26471:26) at _callTimer (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:26390:17) at _callReactNativeMicrotasksPass (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:26420:17) at callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:26583:44) at __callReactNativeMicrotasks (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:5191:46) at anonymous (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:5003:45) at __guard (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:5175:15) at flushedQueue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:5002:21) at invokeCallbackAndReturnFlushedQueue (http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=test.staging:4996:33) LOG [DEBUG] 43:48.175 AWSAppSyncRealTimeProvider - closing WebSocket... LOG [DEBUG] 43:48.321 Hub - Dispatching to auth with {"data": {"Session": null, "attributes": {"email": "my@test.test", "email_verified": true, "name": "my@test.test", "sub": "236448d2-9001-7036-bbec-0234424b9b3d"}, "authenticationFlowType": "USER_SRP_AUTH", "client": {"endpoint": "https://cognito-idp.eu-central-1.amazonaws.com/", "fetchOptions": [Object]}, "keyPrefix": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6", "pool": {"advancedSecurityDataCollectionFlag": true, "client": [Client], "clientId": "65nn0jjpl05h9r18oh4sgkf9u6", "storage": [Function MemoryStorage], "userPoolId": "eu-central-1_647mHYjCN", "wrapRefreshSessionCallback": [Function anonymous]}, "preferredMFA": "NOMFA", "signInUserSession": {"accessToken": [CognitoAccessToken], "clockDrift": 0, "idToken": [CognitoIdToken], "refreshToken": [CognitoRefreshToken]}, "storage": [Function MemoryStorage], "userDataKey": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6.236448d2-9001-7036-bbec-0234424b9b3d.userData", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}, "event": "signOut", "message": "A user has been signed out"} LOG [DEBUG] 43:48.323 Hub - Dispatching to auth with {"data": {"Session": null, "attributes": {"email": "my@test.test", "email_verified": true, "name": "my@test.test", "sub": "236448d2-9001-7036-bbec-0234424b9b3d"}, "authenticationFlowType": "USER_SRP_AUTH", "client": {"endpoint": "https://cognito-idp.eu-central-1.amazonaws.com/", "fetchOptions": [Object]}, "keyPrefix": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6", "pool": {"advancedSecurityDataCollectionFlag": true, "client": [Client], "clientId": "65nn0jjpl05h9r18oh4sgkf9u6", "storage": [Function MemoryStorage], "userPoolId": "eu-central-1_647mHYjCN", "wrapRefreshSessionCallback": [Function anonymous]}, "preferredMFA": "NOMFA", "signInUserSession": {"accessToken": [CognitoAccessToken], "clockDrift": 0, "idToken": [CognitoIdToken], "refreshToken": [CognitoRefreshToken]}, "storage": [Function MemoryStorage], "userDataKey": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6.236448d2-9001-7036-bbec-0234424b9b3d.userData", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}, "event": "signOut", "message": "A user has been signed out"} LOG [DEBUG] 43:48.327 Hub - Dispatching to auth with {"data": {"Session": null, "attributes": {"email": "my@test.test", "email_verified": true, "name": "my@test.test", "sub": "236448d2-9001-7036-bbec-0234424b9b3d"}, "authenticationFlowType": "USER_SRP_AUTH", "client": {"endpoint": "https://cognito-idp.eu-central-1.amazonaws.com/", "fetchOptions": [Object]}, "keyPrefix": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6", "pool": {"advancedSecurityDataCollectionFlag": true, "client": [Client], "clientId": "65nn0jjpl05h9r18oh4sgkf9u6", "storage": [Function MemoryStorage], "userPoolId": "eu-central-1_647mHYjCN", "wrapRefreshSessionCallback": [Function anonymous]}, "preferredMFA": "NOMFA", "signInUserSession": {"accessToken": [CognitoAccessToken], "clockDrift": 0, "idToken": [CognitoIdToken], "refreshToken": [CognitoRefreshToken]}, "storage": [Function MemoryStorage], "userDataKey": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6.236448d2-9001-7036-bbec-0234424b9b3d.userData", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}, "event": "signOut", "message": "A user has been signed out"} LOG [DEBUG] 43:48.329 Hub - Dispatching to auth with {"data": {"Session": null, "attributes": {"email": "my@test.test", "email_verified": true, "name": "my@test.test", "sub": "236448d2-9001-7036-bbec-0234424b9b3d"}, "authenticationFlowType": "USER_SRP_AUTH", "client": {"endpoint": "https://cognito-idp.eu-central-1.amazonaws.com/", "fetchOptions": [Object]}, "keyPrefix": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6", "pool": {"advancedSecurityDataCollectionFlag": true, "client": [Client], "clientId": "65nn0jjpl05h9r18oh4sgkf9u6", "storage": [Function MemoryStorage], "userPoolId": "eu-central-1_647mHYjCN", "wrapRefreshSessionCallback": [Function anonymous]}, "preferredMFA": "NOMFA", "signInUserSession": {"accessToken": [CognitoAccessToken], "clockDrift": 0, "idToken": [CognitoIdToken], "refreshToken": [CognitoRefreshToken]}, "storage": [Function MemoryStorage], "userDataKey": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6.236448d2-9001-7036-bbec-0234424b9b3d.userData", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}, "event": "signOut", "message": "A user has been signed out"} LOG [DEBUG] 43:48.334 Hub - Dispatching to auth with {"data": {"Session": null, "attributes": {"email": "my@test.test", "email_verified": true, "name": "my@test.test", "sub": "236448d2-9001-7036-bbec-0234424b9b3d"}, "authenticationFlowType": "USER_SRP_AUTH", "client": {"endpoint": "https://cognito-idp.eu-central-1.amazonaws.com/", "fetchOptions": [Object]}, "keyPrefix": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6", "pool": {"advancedSecurityDataCollectionFlag": true, "client": [Client], "clientId": "65nn0jjpl05h9r18oh4sgkf9u6", "storage": [Function MemoryStorage], "userPoolId": "eu-central-1_647mHYjCN", "wrapRefreshSessionCallback": [Function anonymous]}, "preferredMFA": "NOMFA", "signInUserSession": {"accessToken": [CognitoAccessToken], "clockDrift": 0, "idToken": [CognitoIdToken], "refreshToken": [CognitoRefreshToken]}, "storage": [Function MemoryStorage], "userDataKey": "CognitoIdentityServiceProvider.65nn0jjpl05h9r18oh4sgkf9u6.236448d2-9001-7036-bbec-0234424b9b3d.userData", "username": "236448d2-9001-7036-bbec-0234424b9b3d"}, "event": "signOut", "message": "A user has been signed out"} LOG [DEBUG] 43:48.563 Hub - Dispatching to analytics with {"data": {"attributes": {"params": "{}"}, "name": "showcase.enterPage"}, "event": "record", "message": "Recording Analytics event"} ```

p.s.: not sure if it is related but sometimes it just hangs on LOG [DEBUG] 43:48.175 AWSAppSyncRealTimeProvider - closing WebSocket... forever

This is the issue on sentry:

image

And this is our code details:

// gets called when the user taps on the logout button
export const signout = async () => {
  await resetApp();
  try {
    await Auth.signOut();
  } catch (err) {
    Alert.alert('Logout failed.');
  }
};
export async function resetApp() {
  await DataStore.clear();
}

I've managed to hugly decrease the number of occurances by moving the DataStore.clear() to the auth hub listener by doing this (but it still happens):

useEffect(() => {
    checkUser();

    /** Hub listener callback */
    const hubListener: HubCallback = (capsule) => {
      // federatedSignIn triggers auth events
      const event = capsule.payload.event;
      switch (event) {
        case 'signIn':
        case 'cognitoHostedUI':
          DataStore.clear().then(() => {
            checkUser();
          });
          break;
        default:
          break;
      }
    };

    return Hub.listen('auth', hubListener);
  }, []);

There is also another issue that happens alot in sentry, I was not able to reproduce myself to be honest and I'm not sure if it is related

image
david-mcafee commented 1 year ago

@mhyassin looking at the logs you provided, it looks like a mutation occurs after the sync engine has stopped. Is it possible that somewhere you are attempting to perform a mutation after calling DataStore.clear? If so, there would be a race condition happening between the mutation and the attempt to clear DataStore.

Also, instead of listening for cognitoHostedUI prior to calling DataStore.clear (as you do in the code sample you provided), I'd recommend waiting for the signOut event from the Auth category before calling DataStore.clear. This is explained in our documentation, but I've also included a code snippet below:

Hub.listen('auth', async (data) => {
    if (data.payload.event === 'signOut') {
        await DataStore.clear();
    }
});
cwomack commented 11 months ago

@mhyassin, did you get a chance to see the question and comment above?

mhyassin commented 11 months ago

@cwomack Yeah, I did, I was giving it sometime to check Sentry, moving DataStore.clear() to the signOut event helped a lot, thanks @david-mcafee