Amplify-js: No Auth module registered in Amplify

Created on 13 Nov 2018  路  6Comments  路  Source: aws-amplify/amplify-js

Describe the bug
A clear and concise description of what the bug is.
"@aws-amplify/core": "1.0.17"
"@aws-amplify/auth": "1.2.9",
"@aws-amplify/api": "1.0.20", - work fine

updating either of the package to next version give this error

No Auth module registered in Amplify

To Reproduce
In one place i have

  Amplify.configure({
      Auth: config
    });

In other i have

  Amplify.register(API)

  const aws_config = {
    aws_appsync_graphqlEndpoint: process.env.APPSYNC_ENDPOINT,
    aws_appsync_region: process.env.AWS_REGION,
    aws_appsync_authenticationType: 'AMAZON_COGNITO_USER_POOLS',
    endpoints: [
      {
        name: 'RequestLogin',
        endpoint: process.env.REQUEST_LOGIN_ENDPOINT
      }
    ]
  }

  inject('amplifyApi', API)

  Amplify.API.configure(aws_config)

Expected behavior
No Auth module registered in Amplify error
Work fine in previous version of amplify ( "@aws-amplify/api": "1.0.20" ) so its regression

Additional context
Might be same or related to https://github.com/aws-amplify/amplify-js/issues/2058 but i dont use storage.

You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = 'DEBUG'; in your app.

Auth investigating

Most helpful comment

its because package manager create individual copy of core/auth/api libs for each of core/auth/api packages.
https://i.imgur.com/66deDd3.png
And it happened because of lock file that was having older versions. Deleting lock file and recreating fixes the issue

All 6 comments

@aldarund Hi how are you importing those modules(Auth, API, Amplify) in your code? It usually happens when you didn't import the Auth module in your code.

@powerful23 I`m importing it (once in code)

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

And as i said it is working with previous release fine. No code change - just change version and will go from working to not working.

its because package manager create individual copy of core/auth/api libs for each of core/auth/api packages.
https://i.imgur.com/66deDd3.png
And it happened because of lock file that was having older versions. Deleting lock file and recreating fixes the issue

Thanks @aldarund !!!! I did an npm update, deleted the folder @aws-amplify from node_modules folder, and then did a npm install. After doing that, it worked.

Thanks @aldarund !!!! I did an npm update, deleted the folder @aws-amplify from node_modules folder, and then did a npm install. After doing that, it worked.

Just wanted to say thank you... this is a hacky thing but definitely worked lml

Thanks @aldarund !!!! I did an npm update, deleted the folder @aws-amplify from node_modules folder, and then did a npm install. After doing that, it worked.

Thanks as well man! This hack worked for me as well!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rygo6 picture rygo6  路  3Comments

cgarvis picture cgarvis  路  3Comments

epicfaace picture epicfaace  路  3Comments

oste picture oste  路  3Comments

guanzo picture guanzo  路  3Comments