amplify-js
amplify-js copied to clipboard
Deeper look into the Require Cycles for React Native
Before opening, please confirm:
- [X] I have searched for duplicate or closed issues and discussions.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React Native
Amplify APIs
Not applicable
Amplify Categories
auth, storage
Environment information
Please refer to the issues listed below
Describe the bug
We recently solved the Async Storage community version update for our React Native customers. There has also been updates for the Require Cycles issues but we still need to validate some of the other warning callout for our customers.
Expected behavior
Make sure there are no warning messages for Require Cycle callout for React Native
Reproduction steps
Please refer to the below issues:
- https://github.com/aws-amplify/amplify-js/issues/5371
- https://github.com/aws-amplify/amplify-js/issues?q=is%3Aissue+require+cycles+is%3Aclosed
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
@sammartinez Following from the previous issue #6031 , the require cycle issue occurs immediately after installing the aws-amplify library to a React Native app (in my case, is RN version 0.63.4). The three warnings are:
WARN Require cycle: ../../node_modules/@aws-amplify/pubsub/lib-esm/index.js -> ../../node_modules/@aws-amplify/pubsub/lib-esm/PubSub.js -> ../../node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js -> ../../node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js -> ../../node_modules/@aws-amplify/pubsub/lib-esm/index.js Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. WARN Require cycle: ../../node_modules/@aws-amplify/datastore/lib-esm/types.js -> ../../node_modules/@aws-amplify/datastore/lib-esm/util.js -> ../../node_modules/@aws-amplify/datastore/lib-esm/types.js Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. WARN Require cycle: ../../node_modules/aws-amplify/lib-esm/index.js -> ../../node_modules/aws-amplify/lib-esm/withSSRContext.js -> ../../node_modules/aws-amplify/lib-esm/index.js Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
@sammartinez Following from the previous issue #6031 , the require cycle issue occurs immediately after installing the aws-amplify library to a React Native app (in my case, is RN version 0.63.4). The three warnings are:
WARN Require cycle: ../../node_modules/@aws-amplify/pubsub/lib-esm/index.js -> ../../node_modules/@aws-amplify/pubsub/lib-esm/PubSub.js -> ../../node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js -> ../../node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js -> ../../node_modules/@aws-amplify/pubsub/lib-esm/index.js Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. WARN Require cycle: ../../node_modules/@aws-amplify/datastore/lib-esm/types.js -> ../../node_modules/@aws-amplify/datastore/lib-esm/util.js -> ../../node_modules/@aws-amplify/datastore/lib-esm/types.js Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. WARN Require cycle: ../../node_modules/aws-amplify/lib-esm/index.js -> ../../node_modules/aws-amplify/lib-esm/withSSRContext.js -> ../../node_modules/aws-amplify/lib-esm/index.js Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
@sammartinez Do you need more information for this issue?
I have the same warnings on a project I'm working on:
Require cycle: node_modules/@aws-amplify/core/lib-esm/index.js -> node_modules/@aws-amplify/core/lib-esm/Providers/index.js -> node_modules/@aws-amplify/core/lib-esm/Providers/AWSCloudWatchProvider.js -> node_modules/@aws-amplify/core/lib-esm/index.js
Calling import { Auth } from '@aws-amplify/auth'
instead of import { Auth } from 'aws-amplify'
has helped a lot. I use to get 4 warnings, but now I only have one.
AWS Dependencies @aws-amplify/ui-components: 1.0.2 amazon-cognito-identity-js: 5.1.0 aws-amplify: 4.2.5, aws-amplify-react-native: 4.3.1
Would be happy to provide more info about it! :)
any update?
Need this fixed please...
no updates on this?
This case is still an issue
I think these warnings should be ignored by the metro default for requireCycleIgnorePatterns
, but they are still getting through for whatever reason. https://facebook.github.io/metro/docs/configuration/#requirecycleignorepatterns
I'm having this error
Require cycle: node_modules/@aws-amplify/pubsub/lib-esm/index.js -> node_modules/@aws-amplify/pubsub/lib-esm/PubSub.js -> node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js -> node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js -> node_modules/@aws-amplify/pubsub/lib-esm/index.js
Would anyone following this issue be able to confirm if they see these warning persisting in a v6 Amplify app? We haven't had reports in v6 tied to this yet, but wanted to check with this thread. Thanks!
We'll close this issue at this point, but if anyone is able to test if these warnings persist on v6 then please leave a comment on his issue or open a new one!
Thank you!