Closed Krishna-Dockare closed 3 weeks 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!
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.
@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.
@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.
@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.
@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.
If the configuration doesn't have the credentials provider, unfortunately getting identity id and AWSCredentials won't work.
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
Would you be able to share the following in details?
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.
@harsh62 Here is the data that you have asked for.
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"
]
}
}
}
}
}
}
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": "
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.signingInWithSRP" = {
"SRPSignInState.notStarted" = {
};
clientMetadata = {
};
password = "
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.signingInWithSRP" = {
"SRPSignInState.initiatingSRPA" = {
clientMetadata = {
};
password = "
loadingStoredCredentials
AWSCognitoAuthPlugin/LoadCredentialStore.swift Starting execution
AWSCognitoAuthPlugin/LoadCredentialStore.swift Retreiving credential deviceMetadata(username: "*")
Checking next step for: signingInWithSRP(AWSCognitoAuthPlugin.SRPSignInState.notStarted, ["password": "
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": "
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.signingInWithSRP" = {
"SRPSignInState.respondingPasswordVerifier" = {
NHexValue = "****";
clientTimestamp = "2024-01-24 07:08:02 +0000";
gHexValue = "*";
password = "
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": "
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": "
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 = "
{ "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": "
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 = "
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.signingInWithSRP" = {
"SRPSignInState.initiatingSRPA" = {
clientMetadata = {
};
password = "
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": "
{
"AuthState.configured" = {
"AuthenticationState.signingIn" = {
"SignInState.signingInWithSRP" = {
"SRPSignInState.respondingPasswordVerifier" = {
NHexValue = "****";
clientTimestamp = "2024-01-24 10:03:37 +0000";
gHexValue = "*";
password = "
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": "
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": "
{
"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 = "
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
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
@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?
@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.*******)
)
@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
.
@harsh62 The issue is happening even on devices not just simulators. So, I don't think resetting the simulator will help.
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.
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.
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 operator
containsAny.', locations='null', path='null', extensions='{errorCode=400}'}], errors=[GraphQLResponse.Error{message='subscription exceeds maximum value limit 20 for operator
containsAny.', 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 operator
containsAny.', locations='null', path='null', extensions='{errorCode=400}'}], errors=[GraphQLResponse.Error{message='subscription exceeds maximum value limit 20 for operator
containsAny.', locations='null', path='null', extensions='{errorCode=400}'}], recoverySuggestion=See attached list of GraphQLResponse.Error objects.}
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
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
Please create a new issue with relevant details if you want our team to look into it.
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.
Describe the bug
when I am trying to Fetch the Amplify auth session as per the following code:
and when I tried to print the session. I am getting following error:
I can see the cognitoTokens are available but it gives credentials error and identityIdError
Steps To Reproduce
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