amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Deeper look into the Require Cycles for React Native

Open sammartinez opened this issue 3 years ago • 7 comments

Before opening, please confirm:

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 avatar Jun 09 '21 17:06 sammartinez

@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.

cyim02 avatar Jun 10 '21 03:06 cyim02

@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?

cyim02 avatar Jul 13 '21 07:07 cyim02

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! :)

paulinhapenedo avatar Aug 31 '21 19:08 paulinhapenedo

any update?

bnb-briankim avatar Apr 22 '22 02:04 bnb-briankim

Need this fixed please...

ApplicationNinja avatar Jun 13 '22 13:06 ApplicationNinja

no updates on this?

jeffinhk avatar Jul 21 '22 21:07 jeffinhk

This case is still an issue

jakex7 avatar Sep 06 '22 12:09 jakex7

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

blwinters avatar Sep 29 '22 17:09 blwinters

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

jayant-lumino avatar Apr 18 '23 14:04 jayant-lumino

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!

cwomack avatar Jan 02 '24 21:01 cwomack

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!

cwomack avatar Jan 16 '24 21:01 cwomack