Error when upgrading to 3.0.11 version with AWSAppSyncRealTimeProvider and cognito identity pool
See original GitHub issueDescribe the bug Hi guys, We updated aws-amplify lib from 2.2.7 to 3.0.11 and since, we cannot make any graphql request (from datastore or graphql api). Here is the error we are receiving now: [WARN] 57:00.206 AWSAppSyncRealTimeProvider - ensure credentials error No Cognito Identity pool provided for unauthenticated access. Uncaught (in promise) Error: No credentials at AWSAppSyncRealTimeProvider.<anonymous> (AWSAppSyncRealTimeProvider.js:1248) at step (AWSAppSyncRealTimeProvider.js:169) at Object.next (AWSAppSyncRealTimeProvider.js:99) at fulfilled (AWSAppSyncRealTimeProvider.js:53)
We didn’t change any config when going to newer version. User can still login and we are receiving accessToken and idToken. When we are rolling back to older version, everything is working again. Does anyone has a clue on where to check or what could be wrong?
(We are not using AWS.config or AWS.credentials in the frontend app at all).
To Reproduce Here is our auth config on entities:
type House
@model
@auth(
rules: [
{ allow: groups, groupsField: "clientId" }
{ allow: private, provider: iam, operations: [read, create, update] }
]
) {
id: ID!
name: String!
...
clientId: ID!
}
Problems occurs when we have signed in the user. On all grapqh request we have this error (from DataStore or from GraphQL API methods). Our amplify init:
Amplify.configure(awsExports)
Our login method:
Auth.signIn(email, password)
The user is well logged in, we are receiving him via Hub with all good params and his accessToken/idToken are ok.
Expected behavior To be able to update to newer version
What is Configured? If applicable, please provide what is configured for Amplify CLI:
- Which resources do you have configured?
- If applicable, please provide your
aws-exports
file:
"aws_project_region": "eu-west-1", "aws_cognito_identity_pool_id": "eu-west-1:xxx", "aws_cognito_region": "eu-west-1", "aws_user_pools_id": "eu-west-1_xxx", "aws_user_pools_web_client_id": "xxxx", "oauth": { "domain": "xxxx-dev.auth.eu-west-1.amazoncognito.com", "scope": [ "phone", "email", "openid", "profile", "aws.cognito.signin.user.admin" ], "redirectSignIn": "https://fddsfdfdf.com/", "redirectSignOut": "https://ddfdfdf.com/", "responseType": "code" }, "federationTarget": "COGNITO_USER_AND_IDENTITY_POOLS", "aws_content_delivery_bucket": "xxxx-hostingbucket-dev", "aws_content_delivery_bucket_region": "eu-west-1", "aws_content_delivery_url": "https://xxxxx.cloudfront.net", "aws_user_files_s3_bucket": "xxxxx-dev", "aws_user_files_s3_bucket_region": "eu-west-1", "aws_appsync_graphqlEndpoint": "https://xxxxx.appsync-api.eu-west-1.amazonaws.com/graphql", "aws_appsync_region": "eu-west-1", "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS" };
- If applicable, please provide your
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:13 (4 by maintainers)
@manueliglesias It’s ok with the delete of node_modules and lockfiles 😉
Thanks for help
Make sure that you have one and only one version of each amplify service in your yarn.lock or package-lock.json. Having multiple versions of the same service is what caused the problem in my project. This can happen if
You are using the aws-amplify package and aws-amplify/datastore, aws-amplify/api,… packages. Use the aws-amplify package OR the specific ones but never mix them.
You are working in a monorepo project where you have different versions of amplify services for different purposes (mobile, web, …) but in the same lockfile. In that case, you must make sure that there are no version discrepancies between your packages and keep only one version.
Once you are sure that you have one and only one version of each amplify service in your lockfile, just do as above -> delete your node_modules and reinstall them.