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

Potential hazard with modular imports #3096

Closed
nihakue opened this issue Apr 15, 2019 · 3 comments
Closed

Potential hazard with modular imports #3096

nihakue opened this issue Apr 15, 2019 · 3 comments
Labels
Core Related to core Amplify issues needs-discussion Used for internal discussions

Comments

@nihakue
Copy link

nihakue commented Apr 15, 2019

Describe the bug
Because each @aws-amplify/* module has a runtime dependency on @aws-amplify/core, it is possible to bundle multiple versions of core. When it comes time for modules to register, they will not be registering on the same class and will therefore never know about eachother.

To Reproduce
Steps to reproduce the behavior:

https://github.com/nihakue/amplify-module-registration-bug

git clone https://github.com/nihakue/amplify-module-registration-bug.git
cd amplify-module-registration-bug
yarn && yarn start

You should be able to see on localhost:3000 that we have three different versions of core, each with different modules registered. Check in src/App.jsx and src/amplify.js to see how this was done by following the docs for consuming amplify modules. The problem arises from the consumer depending on @aws-amplify/core directly at a version prior to the one in your modules.

Expected behavior
I don't have a great answer, since even if @aws-amplify/core was a peer dependency you could get incompatible versions of core being depended on by your modules, but you could definitely be more resilient to this problem by setting the core semver really liberally (as is standard practice for peer dependencies).

Screenshots
https://github.com/nihakue/amplify-module-registration-bug/blob/master/screenshot.png

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
N/A

Sample code
https://github.com/nihakue/amplify-module-registration-bug

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

@stale
Copy link

stale bot commented Jun 15, 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
Copy link

stale bot commented Jun 22, 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 Jun 22, 2019
@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 Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core Related to core Amplify issues needs-discussion Used for internal discussions
Projects
None yet
Development

No branches or pull requests

2 participants