Coder Social home page Coder Social logo

Comments (12)

HuiSF avatar HuiSF commented on May 20, 2024 2

You are importing modules from different packages, which may lead to receive different instances of the Amplify object, which may not be fully configured.

In particular, if you call the .configure() method on the Amplify instance imported directly from @aws-amplify/core, the underlying auth providers won't be created, hence it will throw the error you have encountered. Please use the umbrella package (aws-amplify) and avoid using the @aws-amplfiy namespaced package unless the documentation provides instructions to do so.

from amplify-js.

ShadowOfLies avatar ShadowOfLies commented on May 20, 2024 2

Ran into this same issue during migration from v5 to v6 and I guess my use case is similar to that of @aoneahsan. i.e. Using a pre-existing AWS Cognito instance for auth with the least amount of configuration and reliance on Amplify.

I can confirm that using only the aws-amplify package in the dependency management and replacing

import { Amplify, AuthUserPoolConfig, ResourcesConfig } from '@aws-amplify/core';

with

import { AuthUserPoolConfig, ResourcesConfig } from '@aws-amplify/core';
import { Amplify } from 'aws-amplify';

worked exactly as described above (i.e. avoiding partially configured providers) and did not significantly affect the bundle size, even with development generated bundles.

from amplify-js.

nadetastic avatar nadetastic commented on May 20, 2024 1

@aoneahsan got it. The recommended usage is to import the api's from aws-amplify so it should be working as expected.

Did you have concerns with this? Im looking to understand why you are wanting to use @aws-amplify/core + @aws-amplify/auth - for example are you looking for bundle size improvements?

from amplify-js.

aoneahsan avatar aoneahsan commented on May 20, 2024 1

yes, i want to use these packages so it will improve the final bundle size

from amplify-js.

cwomack avatar cwomack commented on May 20, 2024 1

@aoneahsan, we don't have any resources to share on this because we don't recommend this (as @HuiSF mentioned above). However, this would be the list of categories within Amplify that would utilize the @aws-amplify pattern if you're looking to improve the installation size:

  • geo
  • interactions
  • predictions
  • pubsub
  • adapter-nextjs
  • datastore-storage-adapter

from amplify-js.

nadetastic avatar nadetastic commented on May 20, 2024

HI @aoneahsan thank you for openning this issue. Could you clarify why you are installing both "aws-amplify" and "@aws-amplify/core" + "@aws-amplify/auth" packages? You should only need to install aws-amplify, then import the api's from it.

from amplify-js.

aoneahsan avatar aoneahsan commented on May 20, 2024

basically i wanted to use

@aws-amplify/core + @aws-amplify/auth

that did not work that's why i had to use this aws-amplify

from amplify-js.

elorzafe avatar elorzafe commented on May 20, 2024

@aoneahsan bundle size should not be a problem because the library supports tree shaking capabilities, if you are using a modern bundler (like webpack) it should only include the part of the library you are importing.

from amplify-js.

aoneahsan avatar aoneahsan commented on May 20, 2024

okay, but let's focus on why it's giving error when tried with @aws-amplify/auth package?

from amplify-js.

cwomack avatar cwomack commented on May 20, 2024

@aoneahsan, have you had a chance to review the above comments? Just want to check in and see if there are still any concerns at this point. Thanks.

from amplify-js.

aoneahsan avatar aoneahsan commented on May 20, 2024

I'm using "aws-amplify" package right now and it's working.

but i want to know how to use "@aws-amplify" packages properly

please do share any official resource example showing the process

from amplify-js.

cwomack avatar cwomack commented on May 20, 2024

It looks like we can call this issue resolved then at this point. If anyone following this still has questions or experiencing a further blocker tied to this, feel free to reply back and we can reopen.

from amplify-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.