Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth SignUp auto send another request and throw Error: No credentials, applicationId or region #3484

Closed
namnh06 opened this issue Jun 19, 2019 · 30 comments
Labels
Analytics Related to analytics Auth Related to Auth components/category pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days.

Comments

@namnh06
Copy link

namnh06 commented Jun 19, 2019

** Which Category is your question related to? **
Auth
** What AWS Services are you utilizing? **
Cognito
** Provide additional details e.g. code snippets **
I have 2 projects which are using the same code like this:
Auth.signUp({ username, password, attributes }).then(data => console.log(data)).catch(error => console.log(error)).finally(() => console.log('done'));
Just like this: https://aws-amplify.github.io/docs/js/authentication#sign-up
Here is the problem show out:

message: "Unauthenticated access is not supported for this identity pool."
__type: "NotAuthorizedException"

After that, I got the error in console: Error: No credentials, applicationId or region.

Not sure why is the old project is working fine but with this one, this error show up. Is it because the different in amplify ?

Thanks.

@namnh06
Copy link
Author

namnh06 commented Jun 19, 2019

After trying and creating some new project, I notice that every new project got this issues:

Error: No credentials, applicationId or region

I thought there are some changes in Amplify JS ?

@laurib
Copy link

laurib commented Jun 19, 2019

Run into same problem with new project

@gerrytsui
Copy link
Contributor

Same here. Starting to get this today from the ng e2e, which tests Auth signin workflow. ( I was fine just yesterday)
"ERROR" Error: Uncaught (in promise): Error: No credentials, applicationId or region

while deployed project is working fine. Very strange.

@jdavidhermoso
Copy link

+1.

Everything seems to be working fine, but that message appears in console.

image

@gerrytsui
Copy link
Contributor

gerrytsui commented Jun 19, 2019

Here is what I found so far. ( in my case)
The Uncaught exception is from AWSPinpointProvider.ts ( line 155 record function: public async record(params, handlers: PromiseHandlers) { } )

As soon as I disabled Analytics in my project, it works fine without the error.

I agree the app may works fine for you, but it is not passing my ng e2e testing with that exception.

The fact that there is no code change in my project. I believe it is a change on AWS Pinpoint REST API, combined with obviously, uncaught exception, and caching of credential in my old projects.

@sammartinez sammartinez added Auth Related to Auth components/category Analytics Related to analytics to-be-reproduced Used in order for Amplify to reproduce said issue and removed Analytics Related to analytics labels Jun 19, 2019
@sammartinez
Copy link
Contributor

@namnh06 Can you provide a copy of your package.json, I want to verify which version you are experiencing this on. Even with creating a new project I would just like to see. Also, can you see about using the latest unstable version running npm install --save aws-amplify@unstable or yarn add aws-amplify@unstable depending on your build system you are using. Prior to installing the unstable version, see about doing a full removal of your node_modules and any lock files you have e.g. yarn.lock or package-lock.json

@sammartinez sammartinez added pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days. and removed to-be-reproduced Used in order for Amplify to reproduce said issue labels Jun 19, 2019
@stale stale bot removed the pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days. label Jun 19, 2019
@laurib
Copy link

laurib commented Jun 19, 2019

I get same error with aws-amplify@unstable. Also happens with Auth.signIn()
I have only Auth added to backend

@gerrytsui
Copy link
Contributor

I found the conditions that is causing the AWSPintpointProvider.ts error.

IF I import Analytics from '@aws-amplify/analytics'; even if I don't use it at runtime ( in our project we call analytics.record only in production mode set by environment.prod.ts )
AND the JSON to Amplify.configure is missing the "Analytics" settings ( again we conditionally add the analytics json using Object.assign to add the analytics configs at runtime)

THEN the Uncaught exception will appear.

The exception start to appear today, an is likely because we upgraded to the latest amplify (stable) sometime this week.

versions details ( everything are the latest stable except TypeScript is at 3.4.5)
"@aws-amplify/analytics": "^1.2.17",
"@aws-amplify/api": "^1.0.36",
"@aws-amplify/auth": "^1.2.25",
"@aws-amplify/ui": "^1.0.20",
"aws-amplify-angular": "^3.0.4",

Angular 8.0.3

@laurib
Copy link

laurib commented Jun 19, 2019

My aws-exports.js file is

const awsmobile = {
    "aws_project_region": "...",
    "aws_cognito_identity_pool_id": "...",
    "aws_cognito_region": "...",
    "aws_user_pools_id": "...",
    "aws_user_pools_web_client_id": "...",
    "oauth": {}
};
export default awsmobile;

Should there be generated Auth: {} ?

I kind of remember that there used to be...

Also tried adding Auth with default configuration and custom configuration

@namnh06
Copy link
Author

namnh06 commented Jun 20, 2019

@namnh06 Can you provide a copy of your package.json, I want to verify which version you are experiencing this on. Even with creating a new project I would just like to see. Also, can you see about using the latest unstable version running npm install --save aws-amplify@unstable or yarn add aws-amplify@unstable depending on your build system you are using. Prior to installing the unstable version, see about doing a full removal of your node_modules and any lock files you have e.g. yarn.lock or package-lock.json

Hi @sammartinez ,
For your information:

  • New Project:
"aws-amplify": "^1.1.29",
"aws-amplify-angular": "^3.0.4"
  • Old Project:
"aws-amplify": "^1.1.28",
"aws-amplify-angular": "^3.0.3"

for the whole package.json, you can look at it here: https://gist.github.com/namnh06/336b49acac9edefc4df152a6b3024c46

I tried to remove everything & install aws-amplify with the version like the old one but no luck.

Also, can you see about using the latest unstable version running npm install --save aws-amplify@unstable or yarn add aws-amplify@unstable depending on your build system you are using. Prior to installing the unstable version, see about doing a full removal of your node_modules and any lock files you have e.g. yarn.lock or package-lock.json

Tried it, no luck either.

I thought @gerrytsui was right and wrong, because of if API, so, the old project should be affect too, but there is not.

@ilya-bmi
Copy link

I get the same error with react native after an update.
aws-amplify@1.1.29
"react": "16.8.3",
"react-native": "0.59.9",

@arjunsk
Copy link

arjunsk commented Jun 20, 2019

@namnh06
Copy link
Author

namnh06 commented Jun 20, 2019

@jenshandersson
Copy link

I got it working by reverting @aws-amplify/analytics to 1.2.16.

"aws-amplify": "1.1.28",
"@aws-amplify/analytics": "1.2.16",

@meetfilipe
Copy link

meetfilipe commented Jun 20, 2019

I got it working by reverting @aws-amplify/analytics to 1.2.16.

"aws-amplify": "1.1.28",
"@aws-amplify/analytics": "1.2.16",

Can confirm that this works. Thanks!

@marianocodes
Copy link

I'm experiencing the same issue but I'm not using @aws-amplify/analytics.

@meetfilipe
Copy link

I'm experiencing the same issue but I'm not using @aws-amplify/analytics.

Are you sure you have not imported the whole aws-amplify package?

@marianocodes
Copy link

@filipemcg oh oh oh. Thanks for the tip! using only @aws-amplify/core @aws-amplify/auth fixed the problem!

@adnan333bd
Copy link

adnan333bd commented Jun 24, 2019

we are not using analytics, but updating all imports like the following [no aws-amplify] solved the issue ..

import Amplify from '@aws-amplify/core';
import Auth from '@aws-amplify/auth';
import { Hub } from '@aws-amplify/core';

@WhatIsHeDoing
Copy link

Disabling as per the docs fixed this for me.

@jordanranz
Copy link
Contributor

#3614 should prevent "Error: No credentials, applicationId or region." from occurring when Analytics is not be used or configured.

@stale
Copy link

stale bot commented Aug 8, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days. label Aug 8, 2019
@stale
Copy link

stale bot commented Aug 15, 2019

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

@stale stale bot closed this as completed Aug 15, 2019
@pwfcurry
Copy link

pwfcurry commented Sep 22, 2019

Disabling as per the docs fixed this for me.

Thanks, this worked!

You can also suppress the warning if disabling analytics doesn't fix the issue:

YellowBox.ignoreWarnings(["No credentials, applicationId or region"]);

@nihp
Copy link

nihp commented Apr 29, 2020

I am also facing this issue now.

Note: I am not using analytics anywhere while Auth.signIn and Auth.signUp
I am using the below versions.

  "aws-amplify": "^2.2.5",
   "aws-amplify-react-native": "^3.2.2",

@sanyashvets
Copy link

In your configs:

{
  Auth: {
    identityPoolId: 'REGION_STR:xxxxxxxxxxxxxx', 
    region: 'REGION_STR',
  },
  Analytics: {
    AWSPinpoint: {
      // Amazon Pinpoint App Client ID
      appId: 'xxxxxxxxxxx',
      // Amazon service region
      region: 'us-east-1'
    }
  }
};
  • MAKE SURE THAT identityPoolId starts from i, NOT FROM I * (thanks for incorrect docs and examples)

@nihp
Copy link

nihp commented May 21, 2020

we are not using analytics, but updating all imports like the following [no aws-amplify] solved the issue ..

import Amplify from '@aws-amplify/core';
import Auth from '@aws-amplify/auth';
import { Hub } from '@aws-amplify/core';

@filipemcg oh oh oh. Thanks for the tip! using only @aws-amplify/core @aws-amplify/auth fixed the problem!

Above solutions not worked for me

I am using aws-amplify and aws-amplify-react-native

@aleckzts
Copy link

we are not using analytics, but updating all imports like the following [no aws-amplify] solved the issue ..

import Amplify from '@aws-amplify/core';
import Auth from '@aws-amplify/auth';
import { Hub } from '@aws-amplify/core';

@filipemcg oh oh oh. Thanks for the tip! using only @aws-amplify/core @aws-amplify/auth fixed the problem!

Above solutions not worked for me

I am using aws-amplify and aws-amplify-react-native

The following solution is working for me. Have to manually disable Analytics when using with React Native:

import awsconfig from './aws-exports';
Amplify.configure({
    ...awsconfig,
    Analytics: { 
      disabled: true
    }
});

@gruckionvit
Copy link

This is still an issue, disabling the analytics is not the right solution. Are there any status updates on this? Did anyone figure out what's causing it

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Analytics Related to analytics Auth Related to Auth components/category pending-close-response-required A response is required for this issue to remain open, it will be closed within the next 7 days.
Projects
None yet
Development

No branches or pull requests