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

Viewed 3397

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:

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.

2 Answers

I think the problem is with the Analytics package of AWS from my understanding of this link. Disabling it like so worked for me

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

I solved it by using

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

istead of

import Amplify, { Auth } from 'aws-amplify';
Related