amplify-js: Error: No credentials, applicationId or region

Error: No credentials, applicationId or region with the latest aws-amplify ad aws-amplify-react-native version.

    "aws-amplify": "^3.0.11",
    "aws-amplify-react-native": "^4.1.2",
    "aws-sdk": "^2.681.0",

Auth.signIn succeeds but throws console error and every time it showing the warning

https://github.com/aws-amplify/amplify-js/pull/5629 fix not working in the latest version.

@ashika01 Can you let me know if you have any updates or whether I need to change anything from my side

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 45 (9 by maintainers)

Most upvoted comments

I had the same issue (running on the latest Amplify v3) and worked around it by changing the following:

Amplify.configure({
  ...config,
  Analytics: {
    disabled: true,
  },
});

The strange thing is that I’m not using Analytics at all, but apparently the error is gone.

And what to do if you use Analytics?? (which is my case)

I had the same issue (running on the latest Amplify v3) and worked around it by changing the following:

Amplify.configure({
  ...config,
  Analytics: {
    disabled: true,
  },
});

The strange thing is that I’m not using Analytics at all, but apparently the error is gone.

This fixed my error, thanks!

I had the same issue (running on the latest Amplify v3) and worked around it by changing the following:

Amplify.configure({
  ...config,
  Analytics: {
    disabled: true,
  },
});

The strange thing is that I’m not using Analytics at all, but apparently the error is gone.

@joostfarla Your solution worked for me. Thanks

So I managed to resolve the issue for me. Instead of doing this

import API from '@aws-amplify/api';
import Auth from '@aws-amplify/auth';
import Analytics from '@aws-amplify/analytics';

I now do this import { API, Auth, Analytics } from 'aws-amplify';

As I said in my comment before I had tried this in the past. The difference this time is I actually uninstalled anything related to @aws-amplify. If both @aws-amplify and aws-amplify are in your node_modules then the issue will persist.

While this is a fix, it’s not a fix I am particularly happy with, I now have to import the entire amplify package to have this working rather than individual packages. I’m also not really sure why there is a difference between @aws-amplify and aws-amplify.

If you don’t use Analytics disable it like this. Acording to the docs. Solved for me. Amplify.configure({ ...config, Analytics: { disabled: true, } });

How are we supposed to know this? Where is it documented?

If you don’t use Analytics disable it like this. Acording to the docs. Solved for me. Amplify.configure({ ...config, Analytics: { disabled: true, } });

So I managed to resolve the issue for me. Instead of doing this

import API from '@aws-amplify/api';
import Auth from '@aws-amplify/auth';
import Analytics from '@aws-amplify/analytics';

I now do this import { API, Auth, Analytics } from 'aws-amplify';

As I said in my comment before I had tried this in the past. The difference this time is I actually uninstalled anything related to @aws-amplify. If both @aws-amplify and aws-amplify are in your node_modules then the issue will persist.

While this is a fix, it’s not a fix I am particularly happy with, I now have to import the entire amplify package to have this working rather than individual packages. I’m also not really sure why there is a difference between @aws-amplify and aws-amplify.

Thank you for this feedback @lukehillonline. As of now, this is what we recommend in order to solve your issue. I apologize this is not ideal but we believe the issue is with regards to how dependencies are being referenced when installing individual packages, which leads to triggering this error. You do have the ability to pin specific versions of each package if you would like to, however when a production build is done, any modules that are not in use will be tree shaken out.

With help from the Amplify team, I fixed this issue by rolling back to these specific module versions, clearing yarn cache, cleaning the build, deleting node_modules, and yarn install everything fresh. I no longer get this error.

"@aws-amplify/analytics": "3.3.11",
"@aws-amplify/auth": "3.4.11",
"@aws-amplify/cache": "3.1.36",
"@aws-amplify/core": "3.8.3",
"@aws-amplify/storage": "3.3.11",
"amazon-cognito-identity-js": "4.5.4",

Hey guys, I’ve been fighting Amplify for several days now and I must say I am not impressed with its documentation… it really makes me question the wisdom of going this route - I’m sorry to say.

But I hava a working prototype for Analytics now and thought I’d share my findings. The error I was seeing was:

Uncaught (in promise) Error: No credentials, applicationId or region

This works for me (main/index/…):

import Amplify from '@aws-amplify/core';
import Analytics from '@aws-amplify/analytics';
import Auth from '@aws-amplify/auth';
import awsconfig from './aws-exports';

Amplify.configure(awsconfig);
Auth.configure({ mandatorySignIn: false});
Analytics.record({ name: 'bootup' });

Where the final nail was the:

Auth.configure({ mandatorySignIn: false});

Dependencies that works turned out to be:

 "dependencies": {
    "aws-amplify": "^3.3.9"
  }

I cannot be bothered to try out all the other permutations of packages @aws-amplify/core, analytics, auth etc. I hope this works for you too.

Can anyone explain what is the root cause of the error? And after adding the Analytics: false it worked.

For those of us who NEED Analytics:

Background: I was trying to use this in an Expo React-Native app, but I was getting this error when associating a token with a user (Analytics.updateEndpoint({ ... })) and using @aws-amplify/xxx.

I installed aws-amplify and everything worked fine. So I opened the yarn.lock to see the dependencies versions of the main package.

Turn out this looks like a version mismatch, because this actually worked out for me:

    "@aws-amplify/analytics": "5.2.0",
    "@aws-amplify/auth": "4.4.2",
    "@aws-amplify/core": "4.4.0",
    "@aws-amplify/ui-components": "^1.9.6",
    "amazon-cognito-identity-js": "^5.2.6",

Resolving as the above statement is the solution

The only thing that worked for me when I had this issue was removing the “@aws-amplify” imports and getting everything from the ‘aws-amplify’. Even after I switched my references just the mere presence of the “@” ones caused the error. I would try uninstalling those and see if the issue still persists. good luck!

  • S

On Fri, Oct 9, 2020 at 5:47 AM ltaljaard notifications@github.com wrote:

@sammartinez https://github.com/sammartinez I have run npm update aws-amplify but the error persists. Here is my package.json - is the anything else i need to update as well?

{ “main”: “node_modules/expo/AppEntry.js”, “scripts”: { “start”: “expo start”, “android”: “expo start --android”, “ios”: “expo start --ios”, “web”: “expo start --web”, “eject”: “expo eject”, “amplify-modelgen”: “node amplify/scripts/amplify-modelgen.js”, “amplify-push”: “node amplify/scripts/amplify-push.js” }, “dependencies”: { “@aws-amplify/core”: “^3.4.0”, “@aws-amplify/datastore”: “^2.2.4”, “@expo/vector-icons”: “^10.0.0”, “@react-native-community/masked-view”: “0.1.6”, “@react-native-community/netinfo”: “5.5.1”, “@react-navigation/drawer”: “^5.8.2”, “@react-navigation/material-bottom-tabs”: “^5.2.10”, “@react-navigation/native”: “^5.5.1”, “@react-navigation/stack”: “^5.5.1”, “aws-amplify”: “^3.3.3”, “aws-amplify-react-native”: “^4.2.1”, “aws-sdk”: “^2.770.0”, “expo”: “~37.0.3”, “moment”: “^2.27.0”, “react”: “~16.9.0”, “react-dom”: “~16.9.0”, “react-native”: " https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz", “react-native-action-button”: “^2.8.5”, “react-native-elements”: “^2.0.2”, “react-native-gesture-handler”: “~1.6.0”, “react-native-paper”: “^3.10.1”, “react-native-reanimated”: “~1.7.0”, “react-native-safe-area-context”: “0.7.3”, “react-native-screens”: “~2.2.0”, “react-native-web”: “~0.11.7” }, “devDependencies”: { “@babel/core”: “^7.8.6”, “babel-preset-expo”: “~8.1.0”, “ini”: “^1.3.5”, “inquirer”: “^6.5.1” }, “private”: true }

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-js/issues/5918#issuecomment-706160410, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKF57L5UNN3A2SZHVBPKQM3SJ4A6ZANCNFSM4NMCCB3Q .

– Stefan Johnson CTO

(415) 260-8101 w http://www.outcrowdgroup.com/ww.outspoke.io [image: LinkedIn icon] https://www.linkedin.com/company/35475096 [image: Twitter icon] https://twitter.com/outspoke_io [image: Instagram icon] https://www.instagram.com/outspoke.io Check out our new podcast series I’m with RJ! https://im-with-rj.buzzsprout.com/

*All information contained herein is protected by express or implied confidentiality. * If you received this transmission in error, please delete and do not open or view any attached materials.

@ashika01 This error happens if I use @aws-amplify/analytics and @aws-amplify/core. When I use just import Amplify from 'aws-amplify'; it works.

The problem is that this package is a waaaay huge to just use it for analytics.

Can we have a solution?