aws-amplify / amplify-swift

A declarative library for application development using cloud services.
Apache License 2.0
438 stars 190 forks source link

AWS Cognito Identity Pool is not configured #3459

Closed Krishna-Dockare closed 3 weeks ago

Krishna-Dockare commented 6 months ago

Describe the bug

when I am trying to Fetch the Amplify auth session as per the following code:

let options = AuthFetchSessionRequest.Options(forceRefresh: true)
do {
    let session = try await Amplify.Auth.fetchAuthSession(options: options)
} catch {
    print(error.localizedDescription)
}

and when I tried to print the session. I am getting following error:

{
    awsCredentialsError = "AuthError: Could not fetch AWS Credentials, AWS Cognito Identity Pool is not configured\nRecovery suggestion: Follow the steps to configure AWS Cognito Identity Pool and try again\nCaused by:\ninvalidAccountTypeException";
    cognitoTokens = "[\"accessToken\": \"*******\", \"idToken\": \"*****\", \"refreshToken\": \"*****", \"expiry\": 2024-01-08 13:10:17 +0000]";
    identityIdError = "AuthError: Could not fetch identity Id, AWS Cognito Identity Pool is not configured\nRecovery suggestion: Follow the steps to configure AWS Cognito Identity Pool and try again\nCaused by:\ninvalidAccountTypeException";
    isSignedIn = true;
    userSub = "*****";
}

I can see the cognitoTokens are available but it gives credentials error and identityIdError

Steps To Reproduce

Steps to reproduce the behavior:
1. Create AuthFetchSessionRequest options
2. Fetch the Amplify authSession.

Expected behavior

It should give the user Identity Id and not the errors.

Amplify Framework Version

2.25.2

Amplify Categories

Auth

Dependency manager

Swift PM

Swift version

5

CLI version

12.4.0

Xcode version

15.0.1

Relevant log output

<details>
<summary>Log Messages</summary>

INSERT LOG MESSAGES HERE



### Is this a regression?

No

### Regression additional context

_No response_

### Platforms

iOS

### OS Version

17.1.1

### Device

iPhone xr

### Specific to simulators

No

### Additional context

The issue is happening only in Dev environment, Production environment is working fine.
ruisebas commented 6 months ago

Hi @Krishna-Dockare, thanks for opening this issue.

I was not able to reproduce it using the code snippet you provided, the session was returned successfully and there's no errors when printed.

The "AWS Cognito Identity Pool is not configured" statement suggests there's a configuration problem. Do you have the Identity Pool information set in your amplifyconfiguration.json file?

    "CredentialsProvider": {
        "CognitoIdentity": {
            "Default": {
                "PoolId": "[YOUR_IDENTITY_POOL_ID]",
                "Region": "[YOUR_REGION]"
            }
        }
    },

If the file looks ok, could you please enable verbose logging and share the logs that are printed when you call fetchAuthSession? That could help us identify what's causing your issue.

You can enable verbose logging by doing this before calling Amplify.configure():

Amplify.Logging.logLevel = .verbose

Thanks!

Krishna-Dockare commented 6 months ago

In amplifyconfiguration.json, CredentialProvider is not available.

{
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "api": {
        "plugins": {
            "awsAPIPlugin": {
                "dockareappchat": {
                    "endpointType": "GraphQL",
                    "endpoint": "https://*************.amazonaws.com/graphql",
                    "region": "******",
                    "authorizationType": "AMAZON_COGNITO_USER_POOLS"
                }
            }
        }
    },
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify/cli",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "AppSync": {
                    "Default": {
                        "ApiUrl": "https://***************.amazonaws.com/graphql",
                        "Region": "********",
                        "AuthMode": "AMAZON_COGNITO_USER_POOLS",
                        "ClientDatabasePrefix": "*********_AMAZON_COGNITO_USER_POOLS"
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "*********",
                        "AppClientId": "***********",
                        "Region": "******"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [
                            "SMS"
                        ],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": "***",
                            "passwordPolicyCharacters": []
                        },
                        "signupAttributes": [],
                        "socialProviders": [],
                        "usernameAttributes": [],
                        "verificationMechanisms": [
                            "PHONE_NUMBER"
                        ]
                    }
                }
            }
        }
    }
}

and this is the verbose log for Amplify.Auth.fetchSession:

- isSignedIn: true
  ▿ identityIdResult: Swift.Result<Swift.String, Amplify.AuthError>.failure
    ▿ failure: AuthError: Could not fetch identity Id, AWS Cognito Identity Pool is not configured
Recovery suggestion: Follow the steps to configure AWS Cognito Identity Pool and try again
Caused by:
invalidAccountTypeException
      ▿ service: (3 elements)
        - .0: "Could not fetch identity Id, AWS Cognito Identity Pool is not configured"
        - .1: "Follow the steps to configure AWS Cognito Identity Pool and try again"
        ▿ .2: Optional(AWSCognitoAuthPlugin.AWSCognitoAuthError.invalidAccountTypeException)
          - some: AWSCognitoAuthPlugin.AWSCognitoAuthError.invalidAccountTypeException
  ▿ awsCredentialsResult: Swift.Result<AWSPluginsCore.AWSCredentials, Amplify.AuthError>.failure
    ▿ failure: AuthError: Could not fetch AWS Credentials, AWS Cognito Identity Pool is not configured
Recovery suggestion: Follow the steps to configure AWS Cognito Identity Pool and try again
Caused by:
invalidAccountTypeException
      ▿ service: (3 elements)
        - .0: "Could not fetch AWS Credentials, AWS Cognito Identity Pool is not configured"
        - .1: "Follow the steps to configure AWS Cognito Identity Pool and try again"
        ▿ .2: Optional(AWSCognitoAuthPlugin.AWSCognitoAuthError.invalidAccountTypeException)
          - some: AWSCognitoAuthPlugin.AWSCognitoAuthError.invalidAccountTypeException
  ▿ userPoolTokensResult: Swift.Result<AWSPluginsCore.AuthCognitoTokens, Amplify.AuthError>.success
    ▿ success: ["idToken": "*****", "accessToken": "*****", "expiry": 2024-01-09 06:27:42 +0000, "refreshToken": "*****"]
      - idToken: "***************************"
      - accessToken: "*****************************"
      - refreshToken: "************************"
      ▿ expiration: 2024-01-09 06:27:42 +0000
        - timeIntervalSinceReferenceDate: 726474462.449227

The issue is happening all of a sudden as we have not altered any amplify code, it was working fine early.

ruisebas commented 6 months ago

@Krishna-Dockare You need to have the CredentialsProvider section in your configuration file for Amplify.Auth.fetchAuthSession to work.

You can try doing amplify pull to fetch the information from the backend, but keep in mind this will overwrite any local changes you made to the configuration file. Alternatively, you can just manually add the section with the required information.

Krishna-Dockare commented 6 months ago

@ruisebas , I have done amplify pull but still didn't got the CredentialsProvider in amplifyconfiguration.json and also tried to add manually but still the issue persists.

harsh62 commented 6 months ago

@Krishna-Dockare Would you be able to share your amplify configuration which has the credentials provider info. Your config should have something like:

                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "******",
                            "Region": "*******"
                        }
                    }
                },

Also just to make sure, identityId and awsCredentials would only be returned if the cognito identity config is present. The plugin simply can't return any info related to identity if the config is not present, because the plugin won't know which identity pool to connect with.

Krishna-Dockare commented 6 months ago

@harsh62 , I have already shared amplify configuration in this reply: https://github.com/aws-amplify/amplify-swift/issues/3459#issuecomment-1882443917 It doesn't have the credentials provider.

harsh62 commented 6 months ago

If the configuration doesn't have the credentials provider, unfortunately getting identity id and AWSCredentials won't work.

Krishna-Dockare commented 6 months ago

In production environment also we are not having the CredentialsProvider but it is working fine there. But in dev environment I am unable to query/observe query from Amplify

harsh62 commented 6 months ago

Would you be able to share the following in details?

  1. Dev environment amplify configuration json file redacted all the sensitive info.
  2. Share verbose logs from sign in to fetchAuthSession for dev environment
  3. Prod environment amplify configuration json file redacted all the sensitive info.
  4. Share verbose logs from sign in to fetchAuthSession for Prod environment

This way I can compare what is the difference in the configuration and how it is working.

Would you be able to share how you are managing multiple environments using Amplify? Since this is something that is officially not supported but I want to know how its being managed.

Krishna-Dockare commented 5 months ago

@harsh62 Here is the data that you have asked for.

  1. Dev amplify configuration

    {
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "api": {
        "plugins": {
            "awsAPIPlugin": {
                "dockareappchat": {
                    "endpointType": "GraphQL",
                    "endpoint": "https://*************.amazonaws.com/graphql",
                    "region": "******",
                    "authorizationType": "AMAZON_COGNITO_USER_POOLS"
                }
            }
        }
    },
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify/cli",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "AppSync": {
                    "Default": {
                        "ApiUrl": "https://***************.amazonaws.com/graphql",
                        "Region": "********",
                        "AuthMode": "AMAZON_COGNITO_USER_POOLS",
                        "ClientDatabasePrefix": "*********_AMAZON_COGNITO_USER_POOLS"
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "*********",
                        "AppClientId": "***********",
                        "Region": "******"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [
                            "SMS"
                        ],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": "***",
                            "passwordPolicyCharacters": []
                        },
                        "signupAttributes": [],
                        "socialProviders": [],
                        "usernameAttributes": [],
                        "verificationMechanisms": [
                            "PHONE_NUMBER"
                        ]
                    }
                }
            }
        }
    }
    }
  2. Verbose logs for Dev on Amplify login

    
    Starting execution
    Check if authstate configured
    Auth state configured
    Validating current state
    Signing with userSRP
    Sending signIn event
    Waiting for signin to complete
    Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.notStarted" = { }; }; "AuthorizationState.configured" = { }; }; } AWSCognitoAuthPlugin/IntializeSignInFlow.swift Starting execution Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution Checking next step for: notStarted AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "***") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

idle

No existing device metadata found. AuthEnvironment(configuration: AWSCognitoAuthPlugin.AuthConfiguration.userPools(["endpoint": "N/A", "region": "", "clientId": "", "clientSecret": "(nil)", "pinpointAppId": "(nil)", "poolId": "", "hostedUI": "N/A"]), userPoolConfigData: Optional(["clientSecret": "(nil)", "hostedUI": "N/A", "clientId": "", "endpoint": "N/A", "poolId": "", "region": "", "pinpointAppId": "(nil)"]), identityPoolConfigData: nil, authenticationEnvironment: Optional(AWSCognitoAuthPlugin.BasicAuthenticationEnvironment(srpSignInEnvironment: AWSCognitoAuthPlugin.BasicSRPSignInEnvironment(srpAuthEnvironment: AWSCognitoAuthPlugin.BasicSRPAuthEnvironment(userPoolConfiguration: ["hostedUI": "N/A", "endpoint": "N/A", "region": "", "pinpointAppId": "(nil)", "poolId": "", "clientSecret": "(nil)", "clientId": ""], cognitoUserPoolFactory: (Function), eventIDFactory: (Function), srpClientFactory: (Function), srpConfiguration: (nHexValue: "****", gHexValue: "*"))), userPoolEnvironment: AWSCognitoAuthPlugin.BasicUserPoolEnvironment(userPoolConfiguration: ["clientId": "", "poolId": "", "pinpointAppId": "(nil)", "hostedUI": "N/A", "clientSecret": "(nil)", "region": "", "endpoint": "N/A"], cognitoUserPoolFactory: (Function), cognitoUserPoolASFFactory: (Function), cognitoUserPoolAnalyticsHandlerFactory: (Function)), hostedUIEnvironment: nil)), authorizationEnvironment: nil, credentialsClient: AWSCognitoAuthPlugin.CredentialStoreOperationClient, logger: Amplify.BroadcastLogger) AWSCognitoAuthPlugin/IntializeSignInFlow.swift Sending event SignInEvent.initiateSignInWithSRP AWSCognitoAuthPlugin/StartSRPFlow.swift Start execution AWSCognitoAuthPlugin/StartSRPFlow.swift Sending event SignInEvent.initiateSignInWithSRP AWSCognitoAuthPlugin/InitiateAuthSRP.swift Starting execution Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.signingInWithSRP" = { "SRPSignInState.notStarted" = { }; clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = "**"; }; }; "AuthorizationState.configured" = { }; }; } Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.signingInWithSRP" = { "SRPSignInState.initiatingSRPA" = { clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = ""; }; clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = ""; }; }; "AuthorizationState.configured" = { }; }; } Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "*") Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.notStarted, ["password": "", "username": "", "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "clientMetadata": [:]]) Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.initiatingSRPA(["username": "**", "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "password": "", "clientMetadata": [:]]), ["username": "*", "password": "", "clientMetadata": [:], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)]) AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

idle Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential asfDeviceId(username: "****") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.completedOperation AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

success(AWSCognitoAuthPlugin.CredentialStoreData.asfDeviceId("", "")) Credential Store state change:

idle AWSCognitoAuthPlugin/InitiateAuthSRP.swift Starting execution

AWSCognitoAuthPlugin/InitiateAuthSRP.swift InitiateAuth response success AWSCognitoAuthPlugin/InitiateAuthSRP.swift Sending event SignInEvent(data: nil, id: "**", eventType: AWSCognitoAuthPlugin.SignInEvent.EventType.respondPasswordVerifier(["password": "", "NHexValue": "***", "gHexValue": "*", "srpKeyPair": "<privateKey ****>, <publicKey *>", "clientTimestamp": 2024-01-24 07:08:02 +0000, "username": ""], AWSCognitoIdentityProvider.InitiateAuthOutputResponse(authenticationResult: nil, challengeName: Optional(AWSCognitoIdentityProvider.CognitoIdentityProviderClientTypes.ChallengeNameType.passwordVerifier), challengeParameters: Optional(["USERNAME": "", "SALT": "**", "SECRET_BLOCK": "*", "USER_ID_FOR_SRP": "*****"]), session: nil), [:]), time: nil) AWSCognitoAuthPlugin/VerifyPasswordSRP.swift Starting execution Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.signingInWithSRP" = { "SRPSignInState.respondingPasswordVerifier" = { NHexValue = "****"; clientTimestamp = "2024-01-24 07:08:02 +0000"; gHexValue = "*"; password = ""; srpKeyPair = "<privateKey **>, <publicKey *****>"; username = ""; }; clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = ""; }; }; "AuthorizationState.configured" = { }; }; } Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.respondingPasswordVerifier(["password": "", "NHexValue": "**", "srpKeyPair": "<privateKey *>, <publicKey **>", "clientTimestamp": 2024-01-24 07:08:02 +0000, "gHexValue": "*", "username": ""]), ["password": "", "clientMetadata": [:], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "username": ""]) AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "***") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) Credential Store state change:

idle AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential asfDeviceId(username: "***") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.completedOperation AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

success(AWSCognitoAuthPlugin.CredentialStoreData.asfDeviceId("20BF2D82-9510-46F5-B427-5047D80C7A74", "****")) Credential Store state change:

idle Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "****") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

idle No existing device metadata found. AuthEnvironment(configuration: AWSCognitoAuthPlugin.AuthConfiguration.userPools(["clientId": "", "region": "", "pinpointAppId": "(nil)", "clientSecret": "(nil)", "hostedUI": "N/A", "endpoint": "N/A", "poolId": ""]), userPoolConfigData: Optional(["clientId": "", "region": "", "pinpointAppId": "(nil)", "clientSecret": "(nil)", "hostedUI": "N/A", "endpoint": "N/A", "poolId": ""]), identityPoolConfigData: nil, authenticationEnvironment: Optional(AWSCognitoAuthPlugin.BasicAuthenticationEnvironment(srpSignInEnvironment: AWSCognitoAuthPlugin.BasicSRPSignInEnvironment(srpAuthEnvironment: AWSCognitoAuthPlugin.BasicSRPAuthEnvironment(userPoolConfiguration: ["pinpointAppId": "(nil)", "clientId": "", "region": "", "hostedUI": "N/A", "clientSecret": "(nil)", "endpoint": "N/A", "poolId": ""], cognitoUserPoolFactory: (Function), eventIDFactory: (Function), srpClientFactory: (Function), srpConfiguration: (nHexValue: "**", gHexValue: ""))), userPoolEnvironment: AWSCognitoAuthPlugin.BasicUserPoolEnvironment(userPoolConfiguration: ["pinpointAppId": "(nil)", "clientId": "", "region": "", "hostedUI": "N/A", "clientSecret": "(nil)", "endpoint": "N/A", "poolId": ""], cognitoUserPoolFactory: (Function), cognitoUserPoolASFFactory: (Function), cognitoUserPoolAnalyticsHandlerFactory: (Function)), hostedUIEnvironment: nil)), authorizationEnvironment: nil, credentialsClient: AWSCognitoAuthPlugin.CredentialStoreOperationClient, logger: Amplify.BroadcastLogger) 2024-01-24T12:38:02 info CognitoIdentityProviderClient : [Logging] Request: POST https:443 Path: / Content-Type: application/*-json-1.1, x-amz-user-agent: aws-sdk-swift/1.0, Host: *.amazonaws.com, Content-Length: , User-Agent: aws-sdk-swift/1.0 api/cognito-identity-provider/1.0 os/iOS/17.1.1 lang/swift/5.9 lib/amplify-swift/2.17.1, X-Amz-Target: AWSCognitoIdentityProviderService.RespondToAuthChallenge Optional([]) 2024-01-24T12:38:02 info SerialExecutor : [Logging] Creating connection pool for Optional("https://*****.amazonaws.com/?")with max connections: 50

2024-01-24T12:38:03 info CRTClientEngine : [Logging] Connection was acquired to: Optional("https://*****.amazonaws.com/?")

AWSCognitoAuthPlugin/VerifyPasswordSRP.swift Sending event SignInEvent(data: nil, id: "**", eventType: AWSCognitoAuthPlugin.SignInEvent.EventType.finalizeSignIn(["signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "userId": "****", "userName": "", "signedInDate": 2024-01-24 07:08:03 +0000, "deviceMetadata": ["noData": "noData"], "tokens": ["expiry": 2024-01-24 08:08:03 +0000, "refreshToken": "**", "idToken": "", "accessToken": "*"]]), time: nil) AWSCognitoAuthPlugin/SignInComplete.swift Starting execution AWSCognitoAuthPlugin/SignInComplete.swift Sending event AuthenticationEvent.signInCompleted Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.signedIn(["userId": "****", "signedInDate": 2024-01-24 07:08:03 +0000, "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "userName": "*", "deviceMetadata": ["noData": "noData"], "tokens": ["refreshToken": "", "accessToken": "", "idToken": "", "expiry": 2024-01-24 08:08:03 +0000]]), ["username": "**", "clientMetadata": [:], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "password": ""]) AWSCognitoAuthPlugin/InitializeFetchAuthSessionWithUserPool.swift Starting execution AWSCognitoAuthPlugin/InitializeFetchAuthSessionWithUserPool.swift Sending event FetchAuthSessionEvent.throwError AWSCognitoAuthPlugin/InformSessionError.swift Starting execution AWSCognitoAuthPlugin/InformSessionError.swift Sending event AuthorizationEvent.receivedSessionError AWSCognitoAuthPlugin/PersistCredentials.swift Starting execution Credential Store state change:

storingCredentials AWSCognitoAuthPlugin/StoreCredentials.swift Starting execution Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.signingInWithSRP" = { "SRPSignInState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 07:08:03 +0000"; tokens = "[\"refreshToken\": \"\", \"expiry\": 2024-01-24 08:08:03 +0000, \"idToken\": \"\", \"accessToken\": \"*\"]"; userId = "****"; userName = ""; }; clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = ""; }; }; "AuthorizationState.configured" = { }; }; } Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 07:08:03 +0000"; tokens = "[\"idToken\": \"\", \"accessToken\": \"\", \"expiry\": 2024-01-24 08:08:03 +0000, \"refreshToken\": \"*\"]"; userId = "****"; userName = "**"; }; "AuthorizationState.fetchingAuthSessionWithUserPool" = { "FetchSessionState.notStarted" = { }; }; }; } Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 07:08:03 +0000"; tokens = "[\"idToken\": \"\", \"accessToken\": \"\", \"expiry\": 2024-01-24 08:08:03 +0000, \"refreshToken\": \"*\"]"; userId = "****"; userName = "**"; }; "AuthorizationState.fetchingAuthSessionWithUserPool" = { "FetchSessionState.error" = { error = "AWSCognitoAuthPlugin.FetchSessionError.noIdentityPool"; }; }; }; } Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 07:08:03 +0000"; tokens = "[\"idToken\": \"\", \"accessToken\": \"\", \"expiry\": 2024-01-24 08:08:03 +0000, \"refreshToken\": \"*\"]"; userId = "****"; userName = "**"; }; "AuthorizationState.storingCredentials" = userPoolOnly; }; } AWSCognitoAuthPlugin/StoreCredentials.swift Sending event CredentialStoreEvent.completedOperation AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState AWSCognitoAuthPlugin/PersistCredentials.swift Sending event AuthorizationEvent.sessionEstablished Credential Store state change:

success(AWSCognitoAuthPlugin.CredentialStoreData.amplifyCredentials(userPoolOnly)) Credential Store state change:

idle Received result Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 07:08:03 +0000"; tokens = "[\"refreshToken\": \"\", \"expiry\": 2024-01-24 08:08:03 +0000, \"idToken\": \"\", \"accessToken\": \"*\"]"; userId = "****"; userName = "**"; }; "AuthorizationState.sessionEstablished" = userPoolOnly; }; }


3. Dev verbose logs when tried to observe a query

Initializing database connection: ~/Data/Application/**/Documents/DocSlack.db pragma auto_vacuum = full; pragma encoding = "utf-8"; pragma foreign_keys = on; pragma case_sensitive_like = off; requestApi(convertible:completion:) response total: success(4566 bytes) Initialized ~/Data/Application/***/Documents/DocSlack.db

Setting up 3 models

create table if not exists "ModelSyncMetadata" ( "" text primary key not null, "*" integer ); create table if not exists "MutationEvent" ( "" text primary key not null, "*" text not null, "*" text, "" integer not null, "" text not null, "*" text not null, "**" text not null, "**" text not null, "*****" integer );

create table if not exists "MutationSyncMetadata" ( "" text primary key not null, "**" integer not null, "*" integer not null, "***" integer not null ); Setting up 2 models create table if not exists "" ( "" text primary key not null, "" text, "**" text not null, "**" text, "**" text not null, "**" text not null, "*" integer not null, "" text, "" text, "**" integer not null, "***" text not null, "*" text not null, "****" text not null, "*" text, "*" integer not null, "***" text ); create table if not exists "****" ( "" text primary key not null, "**" text, "" text not null, "" text not null, "*" text, "***" text, "" text not null, "**" text not null, "**" text, "*" integer not null ); create index if not exists "***" on "" ("*", "***"); create index if not exists "" on "Message" ("****");

create index if not exists "*" on "**" ("*"); create index if not exists "" on "" ("**");

Notifying: initialized resolve(notInitialized, initialized) -> stopped New state: stopped respond(to:): stopped

New state: notStarted respond(to:): notStarted

Notifying: receivedStart resolve(notStarted, receivedStart) -> pausingSubscriptions New state: pausingSubscriptions respond(to:): pausingSubscriptions pauseSubscriptions() Notifying: pausedSubscriptions resolve(pausingSubscriptions, pausedSubscriptions) -> pausingMutationQueue New state: pausingMutationQueue respond(to:): pausingMutationQueue pauseMutations() stopSyncingToCloud(_:) Start ObserveQuery Notifying: receivedStop((Function)) select "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "" from "" as "root" where 1 = 1 and "root"."" = order by "root"."" desc resolve(stopped, receivedStop((Function))) -> stopping((Function)) New state: stopping((Function)) select "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "" from "" as "root" where 1 = 1 and "root"."" = order by "root"."" desc respond(to:): stopping((Function)) doStop(completion:) doStopWithoutNotifyingStateMachine() Notifying: doneStopping resolve(stopping((Function)), doneStopping) -> stopped New state: stopped


4. Amplify configuration on Prod

{ "UserAgent": "aws-amplify-cli/2.0", "Version": "1.0", "api": { "plugins": { "awsAPIPlugin": { "dockareappchat": { "endpointType": "GraphQL", "endpoint": "https:***.amazonaws.com/graphql", "region": "**", "authorizationType": "AMAZON_COGNITO_USER_POOLS" } } } }, "auth": { "plugins": { "awsCognitoAuthPlugin": { "UserAgent": "aws-amplify/cli", "Version": "0.1.0", "IdentityManager": { "Default": {} }, "AppSync": { "Default": { "ApiUrl": "https:**.amazonaws.com/graphql", "Region": "**", "AuthMode": "AMAZON_COGNITO_USER_POOLS", "ClientDatabasePrefix": "dockareappchat_AMAZON_COGNITO_USER_POOLS" } }, "CognitoUserPool": { "Default": { "PoolId": "**", "AppClientId": "**", "Region": "**" } }, "Auth": { "Default": { "authenticationFlowType": "USER_SRP_AUTH", "mfaConfiguration": "OFF", "mfaTypes": [ "SMS" ], "passwordProtectionSettings": { "passwordPolicyMinLength": "**", "passwordPolicyCharacters": [] }, "signupAttributes": [], "socialProviders": [], "usernameAttributes": [], "verificationMechanisms": [ "PHONE_NUMBER" ] } } } } } }


5. Verbose logs for Prod on Amplify login

Starting execution Check if authstate configured Auth state configured Validating current state Signing with userSRP Sending signIn event Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.notStarted" = { }; }; "AuthorizationState.configured" = { }; }; } Waiting for signin to complete AWSCognitoAuthPlugin/IntializeSignInFlow.swift Starting execution Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution Checking next step for: notStarted AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "*****") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

idle No existing device metadata found. AuthEnvironment(configuration: AWSCognitoAuthPlugin.AuthConfiguration.userPools(["pinpointAppId": "(nil)", "region": "", "clientId": "", "hostedUI": "N/A", "clientSecret": "(nil)", "endpoint": "N/A", "poolId": ""]), userPoolConfigData: Optional(["region": "", "poolId": "", "endpoint": "N/A", "pinpointAppId": "(nil)", "clientId": "", "clientSecret": "(nil)", "hostedUI": "N/A"]), identityPoolConfigData: nil, authenticationEnvironment: Optional(AWSCognitoAuthPlugin.BasicAuthenticationEnvironment(srpSignInEnvironment: AWSCognitoAuthPlugin.BasicSRPSignInEnvironment(srpAuthEnvironment: AWSCognitoAuthPlugin.BasicSRPAuthEnvironment(userPoolConfiguration: ["endpoint": "N/A", "poolId": "", "pinpointAppId": "(nil)", "clientSecret": "(nil)", "region": "", "hostedUI": "N/A", "clientId": ""], cognitoUserPoolFactory: (Function), eventIDFactory: (Function), srpClientFactory: (Function), srpConfiguration: (nHexValue: "**", gHexValue: ""))), userPoolEnvironment: AWSCognitoAuthPlugin.BasicUserPoolEnvironment(userPoolConfiguration: ["endpoint": "N/A", "poolId": "", "clientSecret": "(nil)", "clientId": "", "region": "", "hostedUI": "N/A", "pinpointAppId": "(nil)"], cognitoUserPoolFactory: (Function), cognitoUserPoolASFFactory: (Function), cognitoUserPoolAnalyticsHandlerFactory: (Function)), hostedUIEnvironment: nil)), authorizationEnvironment: nil, credentialsClient: AWSCognitoAuthPlugin.CredentialStoreOperationClient, logger: Amplify.BroadcastLogger)

AWSCognitoAuthPlugin/IntializeSignInFlow.swift Sending event SignInEvent.initiateSignInWithSRP

AWSCognitoAuthPlugin/StartSRPFlow.swift Start execution AWSCognitoAuthPlugin/StartSRPFlow.swift Sending event SignInEvent.initiateSignInWithSRP AWSCognitoAuthPlugin/InitiateAuthSRP.swift Starting execution Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.notStarted, ["username": "**", "clientMetadata": [:], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "password": ""])

Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.signingInWithSRP" = { "SRPSignInState.notStarted" = { }; clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = ""; }; }; "AuthorizationState.configured" = { }; }; } Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.initiatingSRPA(["username": "", "clientMetadata": [:], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "password": ""]), ["clientMetadata": [:], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "username": "**", "password": ""]) Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.signingInWithSRP" = { "SRPSignInState.initiatingSRPA" = { clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = ""; }; clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = ""; }; }; "AuthorizationState.configured" = { }; }; }

Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "*****") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

idle Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential asfDeviceId(username: "**") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState 2024-01-24T15:33:37 info CognitoIdentityProviderClient : [Logging] Request: POST https:443 Path: / X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth, Content-Type: application/**-json-1.1, Host: ****.amazonaws.com, Content-Length: **, User-Agent: aws-sdk-swift/1.0 api/cognito-identity-provider/1.0 os/iOS/17.1.1 lang/swift/5.9 lib/amplify-swift/2.17.1, x-amz-user-agent: aws-sdk-swift/1.0 Optional([]) 2024-01-24T15:33:37+0530 info SerialExecutor : [Logging] Creating connection pool for Optional("https:***.amazonaws.com/?")with max connections: 50 Credential Store state change:

idle Credential Store state change:

storingCredentials AWSCognitoAuthPlugin/StoreCredentials.swift Starting execution AWSCognitoAuthPlugin/StoreCredentials.swift Sending event CredentialStoreEvent.completedOperation AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

success(AWSCognitoAuthPlugin.CredentialStoreData.asfDeviceId("**", "***")) Credential Store state change:

idle

AWSCognitoAuthPlugin/InitiateAuthSRP.swift Starting execution

2024-01-24T15:33:37 info CRTClientEngine : [Logging] Connection was acquired to: Optional("https:****.amazonaws.com/?")

2024-01-24T15:33:37 info CognitoIdentityProviderClient : [Logging] Request: POST https:443 Path: / x-amz-user-agent: aws-sdk-swift/1.0, Content-Type: application/-json-1.1, X-Amz-Target: AWSCognitoIdentityProviderService.RespondToAuthChallenge, Host: ****.amazonaws.com, User-Agent: aws-sdk-swift/1.0 api/cognito-identity-provider/1.0 os/iOS/17.1.1 lang/swift/5.9 lib/amplify-swift/2.17.1, Content-Length: Optional([]) 2024-01-24T15:33:37+0530 info SerialExecutor : [Logging] Creating connection pool for Optional("https:**.amazonaws.com/?")with max connections: 50 AWSCognitoAuthPlugin/InitiateAuthSRP.swift InitiateAuth response success AWSCognitoAuthPlugin/InitiateAuthSRP.swift Sending event SignInEvent(data: nil, id: "", eventType: AWSCognitoAuthPlugin.SignInEvent.EventType.respondPasswordVerifier(["username": "", "password": "", "srpKeyPair": "<privateKey **>, <publicKey ****>", "clientTimestamp": 2024-01-24 10:03:37 +0000, "NHexValue": "****", "gHexValue": "*"], AWSCognitoIdentityProvider.InitiateAuthOutputResponse(authenticationResult: nil, challengeName: Optional(AWSCognitoIdentityProvider.CognitoIdentityProviderClientTypes.ChallengeNameType.passwordVerifier), challengeParameters: Optional(["SALT": "*", "USER_ID_FOR_SRP": "", "SECRET_BLOCK": "****"]), session: nil), [:]), time: nil) Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.signingInWithSRP" = { "SRPSignInState.respondingPasswordVerifier" = { NHexValue = "****"; clientTimestamp = "2024-01-24 10:03:37 +0000"; gHexValue = "*"; password = ""; srpKeyPair = "<privateKey ****>, <publicKey ****>"; username = ""; }; clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = ""; }; }; "AuthorizationState.configured" = { }; }; } AWSCognitoAuthPlugin/VerifyPasswordSRP.swift Starting execution Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.respondingPasswordVerifier(["srpKeyPair": "<privateKey ****>, <publicKey ****>", "password": "", "clientTimestamp": 2024-01-24 10:03:37 +0000, "username": "*", "gHexValue": "", "NHexValue": "****"]), ["password": "", "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "clientMetadata": [:], "username": "**"]) AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "*****")

AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) Credential Store state change:

idle AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential asfDeviceId(username: "*****") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) Credential Store state change:

idle Credential Store state change:

storingCredentials AWSCognitoAuthPlugin/StoreCredentials.swift Starting execution AWSCognitoAuthPlugin/StoreCredentials.swift Sending event CredentialStoreEvent.completedOperation AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution Credential Store state change:

success(AWSCognitoAuthPlugin.CredentialStoreData.asfDeviceId("**", "*****")) AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

idle Credential Store state change:

loadingStoredCredentials AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "**") AWSCognitoAuthPlugin/LoadCredentialStore.swift Sending event CredentialStoreEvent.throwError AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

error(KeychainStoreError: Unable to find the keychain item Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at: file: ~/amplify-swift/AmplifyPlugins/Core/AWSPluginsCore/Keychain/KeychainStoreError.swift function: recoverySuggestion line: 69) Credential Store state change:

idle No existing device metadata found. AuthEnvironment(configuration: AWSCognitoAuthPlugin.AuthConfiguration.userPools(["clientId": "", "poolId": "", "region": "", "hostedUI": "N/A", "endpoint": "N/A", "clientSecret": "(nil)", "pinpointAppId": "(nil)"]), userPoolConfigData: Optional(["clientId": "", "poolId": "", "region": "", "hostedUI": "N/A", "endpoint": "N/A", "clientSecret": "(nil)", "pinpointAppId": "(nil)"]), identityPoolConfigData: nil, authenticationEnvironment: Optional(AWSCognitoAuthPlugin.BasicAuthenticationEnvironment(srpSignInEnvironment: AWSCognitoAuthPlugin.BasicSRPSignInEnvironment(srpAuthEnvironment: AWSCognitoAuthPlugin.BasicSRPAuthEnvironment(userPoolConfiguration: ["poolId": "", "pinpointAppId": "(nil)", "clientId": "", "region": "", "endpoint": "N/A", "clientSecret": "(nil)", "hostedUI": "N/A"], cognitoUserPoolFactory: (Function), eventIDFactory: (Function), srpClientFactory: (Function), srpConfiguration: (nHexValue: "***", gHexValue: ""))), userPoolEnvironment: AWSCognitoAuthPlugin.BasicUserPoolEnvironment(userPoolConfiguration: ["poolId": "**", "pinpointAppId": "(nil)", "clientId": "****", "region": "", "endpoint": "N/A", "clientSecret": "(nil)", "hostedUI": "N/A"], cognitoUserPoolFactory: (Function), cognitoUserPoolASFFactory: (Function), cognitoUserPoolAnalyticsHandlerFactory: (Function)), hostedUIEnvironment: nil)), authorizationEnvironment: nil, credentialsClient: AWSCognitoAuthPlugin.CredentialStoreOperationClient, logger: Amplify.BroadcastLogger)

2024-01-24T15:33:38 info CRTClientEngine : [Logging] Connection was acquired to: Optional("https:****.amazonaws.com/?") AWSCognitoAuthPlugin/VerifyPasswordSRP.swift Sending event SignInEvent(data: nil, id: "**", eventType: AWSCognitoAuthPlugin.SignInEvent.EventType.finalizeSignIn(["signedInDate": 2024-01-24 10:03:38 +0000, "userName": "", "**": "****", "deviceMetadata": ["noData": "noData"], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "tokens": ["idToken": "", "accessToken": "", "expiry": 2024-01-24 11:03:38 +0000, "refreshToken": "*"]]), time: nil) AWSCognitoAuthPlugin/SignInComplete.swift Starting execution Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.signedIn(["userName": "*", "deviceMetadata": ["noData": "noData"], "tokens": ["refreshToken": "", "expiry": 2024-01-24 11:03:38 +0000, "idToken": "", "accessToken": ""], "****": "****", "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP), "signedInDate": 2024-01-24 10:03:38 +0000]), ["username": "**", "password": "", "clientMetadata": [:], "signInMethod": AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)]) AWSCognitoAuthPlugin/SignInComplete.swift Sending event AuthenticationEvent.signInCompleted AWSCognitoAuthPlugin/InitializeFetchAuthSessionWithUserPool.swift Starting execution AWSCognitoAuthPlugin/InitializeFetchAuthSessionWithUserPool.swift Sending event FetchAuthSessionEvent.throwError AWSCognitoAuthPlugin/InformSessionError.swift Starting execution AWSCognitoAuthPlugin/InformSessionError.swift Sending event AuthorizationEvent.receivedSessionError AWSCognitoAuthPlugin/PersistCredentials.swift Starting execution Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signingIn" = { "SignInState.signingInWithSRP" = { "SRPSignInState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 10:03:38 +0000"; tokens = "[\"accessToken\": \"\", \"refreshToken\": \"\", \"expiry\": 2024-01-24 11:03:38 +0000, \"idToken\": \"*\"]"; **** = "****"; userName = ""; }; clientMetadata = { }; password = ""; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; username = ""; }; }; "AuthorizationState.configured" = { }; }; } Credential Store state change:

storingCredentials AWSCognitoAuthPlugin/StoreCredentials.swift Starting execution Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 10:03:38 +0000"; tokens = "[\"refreshToken\": \"\", \"expiry\": 2024-01-24 11:03:38 +0000, \"idToken\": \"\", \"accessToken\": \"*\"]"; **** = "****"; userName = "kv**zv"; }; "AuthorizationState.fetchingAuthSessionWithUserPool" = { "FetchSessionState.notStarted" = { }; }; }; } Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 10:03:38 +0000"; tokens = "[\"refreshToken\": \"\", \"expiry\": 2024-01-24 11:03:38 +0000, \"idToken\": \"\", \"accessToken\": \"*\"]"; **** = "****"; userName = "**"; }; "AuthorizationState.fetchingAuthSessionWithUserPool" = { "FetchSessionState.error" = { error = "AWSCognitoAuthPlugin.FetchSessionError.noIdentityPool"; }; }; }; } Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 10:03:38 +0000"; tokens = "[\"refreshToken\": \"\", \"expiry\": 2024-01-24 11:03:38 +0000, \"idToken\": \"\", \"accessToken\": \"*\"]"; **** = "****"; userName = "**"; }; "AuthorizationState.storingCredentials" = userPoolOnly; }; } AWSCognitoAuthPlugin/StoreCredentials.swift Sending event CredentialStoreEvent.completedOperation AWSCognitoAuthPlugin/IdleCredentialStore.swift Starting execution AWSCognitoAuthPlugin/PersistCredentials.swift Sending event AuthorizationEvent.sessionEstablished AWSCognitoAuthPlugin/IdleCredentialStore.swift Sending event CredentialStoreEvent.moveToIdleState Credential Store state change:

success(AWSCognitoAuthPlugin.CredentialStoreData.amplifyCredentials(userPoolOnly)) Received result Credential Store state change:

idle Auth state change:

{ "AuthState.configured" = { "AuthenticationState.signedIn" = { deviceMetadata = "[\"noData\": \"noData\"]"; signInMethod = "AWSCognitoAuthPlugin.SignInMethod.apiBased(AWSCognitoAuthPlugin.AuthFlowType.userSRP)"; signedInDate = "2024-01-24 10:03:38 +0000"; tokens = "[\"accessToken\": \"\", \"refreshToken\": \"\", \"expiry\": 2024-01-24 11:03:38 +0000, \"idToken\": \"*\"]"; **** = "****"; userName = "**"; }; "AuthorizationState.sessionEstablished" = userPoolOnly; }; }


6. Prod verbose logs when trying to observe query

Initializing database connection: ~/Data/Application/**/Documents/****.db pragma auto_vacuum = full; pragma encoding = "utf-8"; pragma foreign_keys = on; pragma case_sensitive_like = off; Initialized ~/Data/Application/**/Documents/****.db

Setting up 3 models create table if not exists "ModelSyncMetadata" ( "" text primary key not null, "****" integer ); create table if not exists "MutationEvent" ( "" text primary key not null, "" text not null, "" text, "" integer not null, "" text not null, "" text not null, "" text not null, "" text not null, "" integer ); create table if not exists "MutationSyncMetadata" ( "" text primary key not null, "" integer not null, "" integer not null, "" integer not null ); Setting up 2 models create table if not exists "" ( "" text primary key not null, "" text, "" text not null, "" text, "" text not null, "" text not null, "" integer not null, "" text, "" text, "" integer not null, "" text not null, "" text not null, "" text not null, "" text, "" integer not null, "" text ); create table if not exists "" ( "" text primary key not null, "" text, "" text not null, "" text not null, "" text, "" text, "" text not null, "" text not null, "" text, "" integer not null ); create index if not exists "" on "" ("", ""); create index if not exists "" on "" (""); create index if not exists "" on "" (""); create index if not exists "" on "" (""); create index if not exists "" on "" (""); BEGIN DEFERRED TRANSACTION Checking MutationSyncMetadata records, SQL: select (select count(1) as count from MutationSyncMetadata) as allRecords, (select count(1) as count from MutationSyncMetadata where like '%|%') as newKeys select (select count(1) as count from MutationSyncMetadata) as allRecords, (select count(1) as count from MutationSyncMetadata where like '%|%') as newKeys select (select count(1) as count from MutationSyncMetadata) as allRecords, (select count(1) as count from MutationSyncMetadata where like '%|%') as newKeys No MutationSyncMetadata migration needed. COMMIT TRANSACTION Initialized init(eventSource:) New state: notInitialized Initialized respond(to:): notInitialized Notifying: initialized resolve(notInitialized, initialized) -> stopped New state: stopped respond(to:): stopped New state: notStarted respond(to:): notStarted Notifying: receivedStart resolve(notStarted, receivedStart) -> pausingSubscriptions New state: pausingSubscriptions respond(to:): pausingSubscriptions pauseSubscriptions() Notifying: pausedSubscriptions resolve(pausingSubscriptions, pausedSubscriptions) -> pausingMutationQueue New state: pausingMutationQueue respond(to:): pausingMutationQueue pauseMutations() stopSyncingToCloud(_:) Start ObserveQuery Notifying: receivedStop((Function)) resolve(stopped, receivedStop((Function))) -> stopping((Function)) New state: stopping((Function)) respond(to:): stopping((Function)) doStop(completion:) doStopWithoutNotifyingStateMachine() Notifying: doneStopping resolve(stopping((Function)), doneStopping) -> stopped New state: stopped select "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "" from "" as "root" where 1 = 1 and "root"."" = 50 order by "root"."" desc select "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "" from "" as "root" where 1 = 1 and "root"."" = 50 order by "root"."" desc Time to generate snapshot: 0.001788042 seconds. isSynced: false, count: 0 Notifying: pausedMutationQueue(AWSDataStorePlugin.SQLiteStorageEngineAdapter) resolve(pausingMutationQueue, pausedMutationQueue(AWSDataStorePlugin.SQLiteStorageEngineAdapter)) -> clearingStateOutgoingMutations(AWSDataStorePlugin.SQLiteStorageEngineAdapter) New state: clearingStateOutgoingMutations(AWSDataStorePlugin.SQLiteStorageEngineAdapter) respond(to:): stopped respond(to:): clearingStateOutgoingMutations(AWSDataStorePlugin.SQLiteStorageEngineAdapter) clearStateOutgoingMutations(storageAdapter:) select "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "" from "MutationEvent" as "root" where 1 = 1 and "root"."" = 1 order by "root"."" asc select "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "", "root"."" as "" from "MutationEvent" as "root" where 1 = 1 and "root"."" = 1 order by "root"."" asc Notifying: clearedStateOutgoingMutations(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.SQLiteStorageEngineAdapter) resolve(clearingStateOutgoingMutations(AWSDataStorePlugin.SQLiteStorageEngineAdapter), clearedStateOutgoingMutations(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.SQLiteStorageEngineAdapter)) -> initializingSubscriptions(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.SQLiteStorageEngineAdapter) New state: initializingSubscriptions(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.SQLiteStorageEngineAdapter) respond(to:): initializingSubscriptions(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.SQLiteStorageEngineAdapter) [InitializeSubscription] initializeSubscriptions(api:storageAdapter:) Starting execution Check if authstate configured Auth state configured Fetching current state Session exists, checking validity Starting execution Check if authstate configured Auth state configured Fetching current state Session exists, checking validity Starting execution Check if authstate configured Auth state configured Fetching current state Session exists, checking validity Received subscription: PassthroughSubject [] - Try [1/1] [] - Try [1/1] [] - Try [1/1] [InitializeSubscription.5] Sink reconciliationQueues [InitializeSubscription.5] Sink done reconciliationQueues Received subscription: PassthroughSubject [InitializeSubscription.5] Sink reconciliationQueues [InitializeSubscription.5] Sink done reconciliationQueues Starting execution Check if authstate configured Auth state configured Fetching current state Session exists, checking validity Starting execution Check if authstate configured Auth state configured Fetching current state [] - Try [1/1] Session exists, checking validity Starting execution Check if authstate configured Auth state configured Fetching current state [] - Try [1/1] Session exists, checking validity [] - Try [1/1] onCreateValueListener: connection(Amplify.SubscriptionConnectionState.connecting) onCreateValueListener: connection(Amplify.SubscriptionConnectionState.connecting) onUpdateValueListener: connection(Amplify.SubscriptionConnectionState.connecting) onUpdateValueListener: connection(Amplify.SubscriptionConnectionState.connecting) onDeleteValueListener: connection(Amplify.SubscriptionConnectionState.connecting) onDeleteValueListener: connection(Amplify.SubscriptionConnectionState.connecting) [RealtimeConnectionProvider] Status: notConnected. Connectivity status: satisfied Starting execution Check if authstate configured Auth state configured Fetching current state Session exists, checking validity Generated Header for request - Optional("{\"Authorization\":\"\",\"host\":\"*.amazonaws.com\"}") [StarscreamAdapter] connect. Connecting to url [StarscreamAdapter] viabilityChanged: true [StarscreamAdapter] websocketDidConnect: websocket has been connected. [RealtimeConnectionProvider] WebsocketDidConnect, sending init message [RealtimeConnectionProvider] Starting stale connection timer for 300.0s Starting execution Check if authstate configured Auth state configured Fetching current state Session exists, checking validity [StarscreamAdapter] socket.write - {"type":"connection_init"} [StarscreamAdapter] websocketDidReceive****: - {"type":"connection_ack","payload":{"connectionTimeoutMs":300000}} [RealtimeConnectionProvider] Resetting stale connection timer [RealtimeConnectionProvider] received connectionAck [StarscreamAdapter] websocketDidReceive****: - {"type":"ka"} [RealtimeConnectionProvider] Resetting stale connection timer [AppSyncSubscriptionConnection]: Connection connected, start subscription *. [RealtimeConnectionProvider] received keepAlive [AppSyncSubscriptionConnection]: Connection connected, start subscription . [AppSyncSubscriptionConnection]: Connection connected, start subscription . Starting execution [AppSyncSubscriptionConnection]: Connection connected, start subscription . Check if authstate configured [AppSyncSubscriptionConnection]: Connection connected, start subscription . Auth state configured [AppSyncSubscriptionConnection]: Connection connected, start subscription *. Fetching current state Session exists, checking validity Starting execution Check if authstate configured Auth state configured Fetching current state Session exists, checking validity [StarscreamAdapter] socket.write - {"payload":{"data":"{\"query\":\"subscription OnDelete**** {\n onDelete**** {\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n typename\n _version\n _deleted\n _lastChangedAt\n }\n}\"}","extensions":{"authorization":{"Authorization":"****","host":"****.amazonaws.com"}}},"****":"****","type":"start"} Starting execution Check if authstate configured Auth state configured [StarscreamAdapter] socket.write - {"****":"****","payload":{"extensions":{"authorization":{"Authorization":"****","host":"****.amazonaws.com"}},"data":"{\"query\":\"subscription OnUpdate**** {\n onUpdate**** {\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n __typename\n _version\n _deleted\n _lastChangedAt\n }\n}\"}"},"type":"start"} Fetching current state Session exists, checking validity Starting execution Check if authstate configured Auth state configured Fetching current state [StarscreamAdapter] socket.write - {"****":"****","payload":{"data":"{\"query\":\"subscription OnUpdate**** {\n onUpdate**** {\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n typename\n _version\n _deleted\n _lastChangedAt\n }\n}\"}","extensions":{"authorization":{"Authorization":"****","host":"****.amazonaws.com"}}},"****":"start"} Session exists, checking validity Starting execution Check if authstate configured [StarscreamAdapter] socket.write - {"payload":{"data":"{\"query\":\"subscription OnDelete**** {\n onDelete**** {\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n typename\n _version\n _deleted\n _lastChangedAt\n }\n}\"}","extensions":{"authorization":{"Authorization":"****","host":"****.amazonaws.com"}}},"****":"****","****":"start"} Auth state configured Fetching current state Session exists, checking validity Starting execution Check if authstate configured Auth state configured [StarscreamAdapter] socket.write - {"****":"****","payload":{"extensions":{"authorization":{"Authorization":"****","host":"****.amazonaws.com"}},"data":"{\"query\":\"subscription OnCreate**** {\n onCreate**** {\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n __typename\n _version\n _deleted\n _lastChangedAt\n }\n}\"}"},"****":"start"} Fetching current state Session exists, checking validity [StarscreamAdapter] socket.write - {"****":"****","payload":{"data":"{\"query\":\"subscription OnCreate**** {\n onCreate**** {\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n typename\n _version\n _deleted\n _lastChangedAt\n }\n}\"}","extensions":{"authorization":{"Authorization":"****","host":"****.amazonaws.com"}}},"****":"start"} [StarscreamAdapter] websocketDidReceive****: - {"****":"****","****":"start_ack"} [RealtimeConnectionProvider] Resetting stale connection timer onCreateValueListener: connection(Amplify.SubscriptionConnectionState.connected) [StarscreamAdapter] websocketDidReceive****: - {"****":"****","****":"start_ack"} [RealtimeConnectionProvider] Resetting stale connection timer onUpdateValueListener: connection(Amplify.SubscriptionConnectionState.connected) [StarscreamAdapter] websocketDidReceive****: - {"****":"****","****":"start_ack"} [RealtimeConnectionProvider] Resetting stale connection timer [StarscreamAdapter] websocketDidReceive****: - {"****":"****","****":"start_ack"} [RealtimeConnectionProvider] Resetting stale connection timer [StarscreamAdapter] websocketDidReceive****: - {"****":"****","****":"start_ack"} [RealtimeConnectionProvider] Resetting stale connection timer onDeleteValueListener: connection(Amplify.SubscriptionConnectionState.connected) onCreateValueListener: connection(Amplify.SubscriptionConnectionState.connected) onDeleteValueListener: connection(Amplify.SubscriptionConnectionState.connected) [StarscreamAdapter] websocketDidReceive****: - {"****":"****","****":"startack"} receive(:): connection(Amplify.SubscriptionConnectionState.connected) [RealtimeConnectionProvider] Resetting stale connection timer dispose(of subscriptionEvent): connection(Amplify.SubscriptionConnectionState.connected) connectionState now connected [InitializeSubscription.4] .connected **** onUpdateValueListener: connection(Amplify.SubscriptionConnectionState.connected) [InitializeSubscription.5] 1/2 initialized receive(_:): connection(Amplify.SubscriptionConnectionState.connected) dispose(of subscriptionEvent): connection(Amplify.SubscriptionConnectionState.connected) connectionState now connected [InitializeSubscription.4] .connected **** [InitializeSubscription.5] 2/2 initialized [InitializeSubscription.6] connected isInitialized [InitializeSubscription.5] RemoteSyncEngine IncomingEventReconciliationQueueEvent.initialized

Notifying: initializedSubscriptions resolve(initializingSubscriptions(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.SQLiteStorageEngineAdapter), initializedSubscriptions) -> performingInitialSync New state: performingInitialSync respond(to:): performingInitialSync [InitializeSubscription.6] performInitialSync() Beginning initial sync

Beginning sync for **** select "root"."****" as "****", "root"."lastSync" as "lastSync" from "ModelSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****' select "root"."****" as "****", "root"."lastSync" as "lastSync" from "ModelSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****' [****] - Try [1/1] Starting query **** { "variables" : { "limit" : 1000 }, "query" : "query Sync****s($limit: Int) {\n sync****s(limit: $limit) {\n items {\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n __typename\n _version\n _deleted\n _lastChangedAt\n }\n nextToken\n startedAt\n }\n}" } Starting execution Check if authstate configured Auth state configured Fetching current state Session exists, checking validity Starting network task for query **** [Operation ****] - Success New state: waiting respond(to:): waiting main() select count("****") from "ModelSyncMetadata" where "****" = '****' insert into "ModelSyncMetadata" ("****", "lastSync") values ('****', ****) select "root"."****" as "****", "root"."lastSync" as "lastSync" from "ModelSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****' select "root"."****" as "****", "root"."lastSync" as "lastSync" from "ModelSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****' Beginning sync for **** select "root"."****" as "****", "root"."lastSync" as "lastSync" from "ModelSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****' select "root"."****" as "****", "root"."lastSync" as "lastSync" from "ModelSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****' [****] - Try [1/1] Starting query **** { "variables" : { "limit" : 1000 }, "query" : "query Sync****s($limit: Int) {\n sync****s(limit: $limit) {\n items {\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n ****\n __typename\n _version\n _deleted\n _lastChangedAt\n }\n nextToken\n startedAt\n }\n}" } Starting execution Check if authstate configured Auth state configured Fetching current state Session exists, checking validity Starting network task for query **** Notifying: started([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301163932, version: 1))]) resolve(waiting, started([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301163932, version: 1))])) -> reconciling([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301163932, version: 1))]) New state: reconciling([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301163932, version: 1))]) respond(to:): reconciling([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301163932, version: 1))]) BEGIN DEFERRED TRANSACTION COMMIT TRANSACTION select "root"."****" as "****", "root"."****" as "****", "root"."graphQLFilterJSON" as "graphQLFilterJSON", "root"."inProcess" as "inProcess", "root"."json" as "json", "root"."modelId" as "modelId", "root"."modelName" as "modelName", "root"."mutationType" as "mutationType", "root"."version" as "version" from "MutationEvent" as "root" where 1 = 1 and ( ( ( "root"."modelId" = '****' and "root"."modelName" = '****' ) or ( "root"."modelId" = '****' and "root"."modelName" = '****' ) or ( "root"."modelId" = '****' and "root"."modelName" = '****' ) ) and ( "root"."inProcess" = 0 or "root"."inProcess" is null ) ) order by "root"."****" asc select "root"."****" as "****", "root"."****" as "****", "root"."graphQLFilterJSON" as "graphQLFilterJSON", "root"."inProcess" as "inProcess", "root"."json" as "json", "root"."modelId" as "modelId", "root"."modelName" as "modelName", "root"."mutationType" as "mutationType", "root"."version" as "version" from "MutationEvent" as "root" where 1 = 1 and ( ( ( "root"."modelId" = '****' and "root"."modelName" = '****' ) or ( "root"."modelId" = '****' and "root"."modelName" = '****' ) or ( "root"."modelId" = '****' and "root"."modelName" = '****' ) ) and ( "root"."inProcess" = 0 or "root"."inProcess" is null ) ) order by "root"."****" asc select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and ( "root"."****" = '****|****' or "root"."****" = '****|****' or "root"."****" = '****|****' ) select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and ( "root"."****" = '****|****' or "root"."****" = '****|****' or "root"."****" = '****|****' ) select count("****") from "****" where "****" = '****' insert into "****" ("****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****") values ('****', NULL, '****', '2023-11-03T05:58:42.765Z', '****', '****', ****, '["****","****"]', '****', ****, '****', '2023-11-03T05:58:42.638Z', '****', NULL, ****, '2023-11-03T05:58:42.765Z') select "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****" from "****" as "root" where 1 = 1 and "root"."****" = '****' select "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****" from "****" as "root" where 1 = 1 and "root"."****" = '****' select count("****") from "****" where "****" = '****' insert into "****" ("****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****") values ('****', NULL, '****', '2023-11-09T13:41:52.702Z', '****', '****', ****, '["****","****"]', '****', ****, '****', '2023-11-09T13:41:52.538Z', '****', NULL, ****, '2023-11-09T13:41:52.702Z') select "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****" from "****" as "root" where 1 = 1 and "root"."****" = '****' select "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****" from "****" as "root" where 1 = 1 and "root"."****" = '****' select count("****") from "****" where "****" = '****' insert into "****" ("****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****", "****") values ('****', NULL, '****', '2023-11-18T09:52:43.909Z', '****', '****', ****, '["****","****"]', '****', ****, '****', '2023-11-18T09:52:43.674Z', '****', NULL, ****, '2023-11-18T09:52:43.909Z') select "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****" from "****" as "root" where 1 = 1 and "root"."****" = '****' select "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****" from "****" as "root" where 1 = 1 and "root"."****" = '****' select count("****") from "MutationSyncMetadata" where "****" = '****|****' insert into "MutationSyncMetadata" ("****", "deleted", "lastChangedAt", "version") values ('****|****', ****, ****, 1) select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****|****' select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****|****' select count("****") from "MutationSyncMetadata" where "****" = '****|****' insert into "MutationSyncMetadata" ("****", "deleted", "lastChangedAt", "version") values ('****|****', ****, ****, 1) select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****|****' select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****|****' select count("****") from "MutationSyncMetadata" where "****" = '****|****' insert into "MutationSyncMetadata" ("****", "deleted", "lastChangedAt", "version") values ('****|****', ****, 1700301163932, 1) select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****|****' select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****|****' Notifying: reconciled resolve(reconciling([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-03 05:58:42 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-09 13:41:52 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: ****, version: 1)), AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: ****, ****: "****", ****: ****, ****: "****", ****: "****", ****: "****", ****: ****.****.**, ****: Optional("****"), ****: nil, ****: nil, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: ****, ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301163932, version: 1))]), reconciled) -> finished New state: finished respond(to:): finished [Lifecycle event 3]: modelSyncedEvent model: **** [Lifecycle event 3]: modelSyncedReceived progress: 1/2 Emitting DataStore event: modelSyncedEvent ModelSyncedEvent(modelName: "****", isFullSync: true, isDeltaSync: false, added: *, updated: ****, deleted: 0) [Operation ****] - Success New state: waiting respond(to:): waiting main() select count("****") from "ModelSyncMetadata" where "****" = '****' insert into "ModelSyncMetadata" ("****", "lastSync") values ('****', 1706095851543) Notifying: started([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: "****", ****: "****", ****: **** ****: ****.****.**, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301164241, version: 1))]) resolve(waiting, started([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: "****", ****: "****", ****: **** ****: ****.****.**, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301164241, version: 1))])) -> reconciling([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: "****", ****: "****", ****: **** ****: ****.****.**, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301164241, version: 1))]) New state: reconciling([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: "****", ****: "****", ****: **** ****: ****.****.**, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301164241, version: 1))]) respond(to:): reconciling([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: "****", ****: "****", ****: **** ****: ****.****.**, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301164241, version: 1))]) BEGIN DEFERRED TRANSACTION COMMIT TRANSACTION select "root"."****" as "****", "root"."lastSync" as "lastSync" from "ModelSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****' select "root"."****" as "****", "root"."****" as "****", "root"."graphQLFilterJSON" as "graphQLFilterJSON", "root"."inProcess" as "inProcess", "root"."json" as "json", "root"."modelId" as "modelId", "root"."modelName" as "modelName", "root"."mutationType" as "mutationType", "root"."version" as "version" from "MutationEvent" as "root" where 1 = 1 and ( ( ( "root"."modelId" = '****' and "root"."modelName" = '****' ) ) and ( "root"."inProcess" = 0 or "root"."inProcess" is null ) ) order by "root"."****" asc select "root"."****" as "****", "root"."****" as "****", "root"."graphQLFilterJSON" as "graphQLFilterJSON", "root"."inProcess" as "inProcess", "root"."json" as "json", "root"."modelId" as "modelId", "root"."modelName" as "modelName", "root"."mutationType" as "mutationType", "root"."version" as "version" from "MutationEvent" as "root" where 1 = 1 and ( ( ( "root"."modelId" = '****' and "root"."modelName" = '****' ) ) and ( "root"."inProcess" = 0 or "root"."inProcess" is null ) ) order by "root"."****" asc select "root"."****" as "****", "root"."lastSync" as "lastSync" from "ModelSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****' select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and ( "root"."****" = '****|****' ) Successfully finished sync select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and ( "root"."****" = '****|****' ) Notifying: performedInitialSync resolve(performingInitialSync, performedInitialSync) -> activatingCloudSubscriptions New state: activatingCloudSubscriptions select count("****") from "****" where "****" = '****' respond(to:): activatingCloudSubscriptions activateCloudSubscriptions() [InitializeSubscription.6] RemoteSyncEngine IncomingEventReconciliationQueueEvent.started insert into "****" ("****", "****", "****", "****", "****", "****", "****", "****", "****", "****") values ('****', '2023-11-18T09:52:44.217Z', '****', '****', '["****","****"]', NULL, '2023-11-18T09:52:43.717Z', '****', '2023-11-18T09:52:44.217Z', 50) select "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****" from "****" as "root" where 1 = 1 and "root"."****" = '****' select "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****", "root"."****" as "****" from "****" as "root" where 1 = 1 and "root"."****" = '****' select count("****") from "MutationSyncMetadata" where "****" = '****|****' insert into "MutationSyncMetadata" ("****", "deleted", "lastChangedAt", "version") values ('****|****', ****, 1700301164241, 1) select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****|****' select "root"."****" as "****", "root"."deleted" as "deleted", "root"."lastChangedAt" as "lastChangedAt", "root"."version" as "version" from "MutationSyncMetadata" as "root" where 1 = 1 and "root"."****" = '****|****' Notifying: activatedCloudSubscriptions(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)) resolve(activatingCloudSubscriptions, activatedCloudSubscriptions(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue))) -> activatingMutationQueue(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)) New state: activatingMutationQueue(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)) respond(to:): activatingMutationQueue(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)) startMutationQueue(api:mutationEventPublisher:reconciliationQueue:) startSyncingToCloud(api:mutationEventPublisher:reconciliationQueue:) [Lifecycle event 3]: modelSyncedEvent model: **** Notifying: receivedStart(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)) Notifying: reconciled resolve(stopped, receivedStart(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue))) -> starting(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)) New state: starting(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)) respond(to:): starting(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)) resolve(reconciling([AWSPluginsCore.MutationSync(model: AWSPluginsCore.AnyModel(****: "****", instance: ****.****(****: "****", ****: "****", ****: "****", ****: **** ****: ****.****.**, ****: Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:43 +0000), ****: nil, ****: Optional(["****", "****"]), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000)), ****: Optional(Amplify.Temporal.DateTime(foundationDate: 2023-11-18 09:52:44 +0000))), modelName: "****"), syncMetadata: AWSPluginsCore.MutationSyncMetadata(****: "****|****", deleted: false, lastChangedAt: 1700301164241, version: 1))]), reconciled) -> finished doStart(api:mutationEventPublisher:reconciliationQueue:) New state: finished select "root"."****" as "****", "root"."****" as "****", "root"."graphQLFilterJSON" as "graphQLFilterJSON", "root"."inProcess" as "inProcess", "root"."json" as "json", "root"."modelId" as "modelId", "root"."modelName" as "modelName", "root"."mutationType" as "mutationType", "root"."version" as "version" from "MutationEvent" as "root" where 1 = 1 and ( "root"."inProcess" = 0 or "root"."inProcess" is null ) [Lifecycle event 3]: modelSyncedReceived progress: 2/2 respond(to:): finished Notifying: activatedMutationQueue Emitting DataStore event: modelSyncedEvent ModelSyncedEvent(modelName: "****", isFullSync: true, isDeltaSync: false, added: **, updated: 0, deleted: 0) select "root"."****" as "****", "root"."****" as "****", "root"."graphQLFilterJSON" as "graphQLFilterJSON", "root"."inProcess" as "inProcess", "root"."json" as "json", "root"."modelId" as "modelId", "root"."modelName" as "modelName", "root"."mutationType" as "mutationType", "root"."version" as "version" from "MutationEvent" as "root" where 1 = 1 and ( "root"."inProcess" = 0 or "root"."inProcess" is null ) resolve(activatingMutationQueue(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)), activatedMutationQueue) -> notifyingSyncStarted

Time to generate snapshot: 0.0 seconds. isSynced: true, count: 1 New state: notifyingSyncStarted respond(to:): notifyingSyncStarted

Notifying: notifiedSyncStarted resolve(notifyingSyncStarted, notifiedSyncStarted) -> syncEngineActive New state: syncEngineActive respond(to:): syncEngineActive receive(subscriber:) RemoteSyncEngine SyncEngineActive receive(subscription:) Notifying: receivedSubscription resolve(starting(<AWSAPIPlugin.AWSAPIPlugin: 0x283a74c00>, AWSDataStorePlugin.AWSMutationEventPublisher, Optional(AWSDataStorePlugin.AWSIncomingEventReconciliationQueue)), receivedSubscription) -> requestingEvent New state: requestingEvent respond(to:): requestingEvent requestEvent() requestNextEvent() getNextMutationEvent(completion:) select "root"."****" as "****", "root"."****" as "****", "root"."graphQLFilterJSON" as "graphQLFilterJSON", "root"."inProcess" as "inProcess", "root"."json" as "json", "root"."modelId" as "modelId", "root"."modelName" as "modelName", "root"."mutationType" as "mutationType", "root"."version" as "version" from "MutationEvent" as "root" where 1 = 1 and ( "root"."inProcess" = 0 or "root"."inProcess" is null ) order by "root"."****" asc select "root"."****" as "****", "root"."****" as "****", "root"."graphQLFilterJSON" as "graphQLFilterJSON", "root"."inProcess" as "inProcess", "root"."json" as "json", "root"."modelId" as "modelId", "root"."modelName" as "modelName", "root"."mutationType" as "mutationType", "root"."version" as "version" from "MutationEvent" as "root" where 1 = 1 and ( "root"."inProcess" = 0 or "root"."inProcess" is null ) order by "root"."****" asc

harsh62 commented 5 months ago

@Krishna-Dockare I see that both dev and prod returns the same result for Authorization. i.e. "AuthorizationState.sessionEstablished" = userPoolOnly;. So if you try to do a fetchAuthSession on either dev or prod, it will return the same result. I think the problem lies in some other part of the code. I don't see much difference in the configuration for dev and prod that could result in this.

Would you be able to share code snippets around the observe query and how you are switching between environments i.e. how you are providing dev and prod configs to Amplify?

Krishna-Dockare commented 5 months ago

@harsh62 I am changing the environments using terminal command amplify checkout env <name>

here is the snippet of code for observe query:

let predicate = *******.keys.******* == *******
let subscription = Amplify.DataStore.observeQuery(
            for: *******.self,
            where:predicate,
            sort: .descending(********.keys.*******)
)
harsh62 commented 5 months ago

@Krishna-Dockare When you switch between environments, and if you are using a simulator to test, could you please reset the simulator and then run the application?

From what I see is that after switching between environments, the DataStore pugin is not in an ideal state to run observeQuery.

Krishna-Dockare commented 5 months ago

@harsh62 The issue is happening even on devices not just simulators. So, I don't think resetting the simulator will help.

lawmicha commented 5 months ago

Hi @Krishna-Dockare, here's some additional debugging context related to ObserveQuery. It performs a Query and Observe to generate its snapshots from changes to the local database, so it's unlikely to find the bug related to Auth from those logs. To isolate this issue related to the Auth and DataStore plugin, can you get the logs for DataStore.start()? This establishes a couple of network calls to your AppSync backend such as the subscription operations and performs a syncQuery to pull down your data into the local database. After you configure Amplify, kick off DataStore.start() for the logs. It should transition to a ready state. To further debug DataStore, could you provide us with your schema, redacted if needed.

Krishna-Dockare commented 4 months ago

Hi @lawmicha , We are getting this error : IdentityId not present because: ConfigurationException{message=Could not retrieve Identity ID, cause=null, recoverySuggestion=Cognito Identity not configured. Please check amplifyconfiguration.json file.}

We have a scenario where users will be added to multiple participant groups(channels) and the users will be subscribing to the group and observing the changes.

Will there be any limit for the number of channels that a user can subscribe to and may I what could be the reason that is causing the above mentioned error.

When the cognito user created newly, the issue is not there.

Krishna-Dockare commented 4 months ago

Hi @lawmicha We are getting this error after user has been logged in and out for multiple times.

DataStoreException{message=DataStore subscriptionProcessor failed to start., cause=GraphQLResponseException{message=Subscription error for MessageRecipient: [GraphQLResponse.Error{message='subscription exceeds maximum value limit 20 for operatorcontainsAny.', locations='null', path='null', extensions='{errorCode=400}'}], errors=[GraphQLResponse.Error{message='subscription exceeds maximum value limit 20 for operatorcontainsAny.', locations='null', path='null', extensions='{errorCode=400}'}], recoverySuggestion=See attached list of GraphQLResponse.Error objects.}, recoverySuggestion=Check your internet.}

and this error:

GraphQLResponseException{message=Subscription error for MessageRecipient: [GraphQLResponse.Error{message='subscription exceeds maximum value limit 20 for operatorcontainsAny.', locations='null', path='null', extensions='{errorCode=400}'}], errors=[GraphQLResponse.Error{message='subscription exceeds maximum value limit 20 for operatorcontainsAny.', locations='null', path='null', extensions='{errorCode=400}'}], recoverySuggestion=See attached list of GraphQLResponse.Error objects.}

lawmicha commented 4 months ago

Hi @Krishna-Dockare, there seems to be a lot going on. Could you open a new issue for each problem you are facing? For example, IdentityId not present error, in a new bug report, could you expand on the details of your use case such as adding users to Cognito groups or something else? what steps can we take to reproduce the problem? and what limits are you referring to, client or service limits? Please try to fill out the relevant sections of the bug report.

For DataStore subscriptionProcessor failed to start, can you create a separate bug report as well. For DataStore, any sort of configuration you've set on DataStoreConfiguration, and your schema will be helpful, you can start here: https://docs.amplify.aws/javascript/tools/cli/reference/diagnose/ amplify diagnose --send-report

lawmicha commented 4 months ago

Also is the error coming from Android DataStore? I can see the message "DataStore subscriptionProcessor failed to start." thrown here: https://github.com/aws-amplify/amplify-android/blob/956ba11edd7f906e2ada953ec04a1a182ca3df29/aws-datastore/src/main/java/com/amplifyframework/datastore/syncengine/Orchestrator.java#L345

You can open an issue over in the Android repo over at https://github.com/aws-amplify/amplify-android/issues/new?assignees=&labels=&projects=&template=1.bug_report.yaml

harsh62 commented 3 weeks ago

Please create a new issue with relevant details if you want our team to look into it.

github-actions[bot] commented 3 weeks ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.