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

Require Cycle: DocumentReference <> DocumentSnapshot #1446

Closed
TrekSoft opened this issue Aug 31, 2018 · 33 comments
Closed

Require Cycle: DocumentReference <> DocumentSnapshot #1446

TrekSoft opened this issue Aug 31, 2018 · 33 comments
Assignees
Labels
plugin: firestore Firebase Cloud Firestore Type: Stale Issue has become stale - automatically added by Stale bot Workflow: Waiting for User Response Blocked waiting for user response.
Milestone

Comments

@TrekSoft
Copy link

Issue

The newest version of react native (0.57.0-rc.3) has started giving yellow bar warnings about require cycles.

I'm using v5.6.0 of react-native-firebase and am getting a warning about this require cycle:

Require cycle: node_modules\react-native-firebase\dist\modules\firestore\DocumentReference.js -> node_modules\react-native-firebase\dist\modules\firestore\DocumentSnapshot.js -> node_modules\react-native-firebase\dist\modules\firestore\DocumentReference.js

Environment

  1. Application Target Platform:

Android

  1. Development Operating System:

Windows 10

  1. Build Tools:

N/A

  1. React Native version:

0.57.0-rc.3

  1. React Native Firebase Version:

5.6.0

  1. Firebase Module:

Firestore

  1. Are you using typescript?

No

@TrekSoft
Copy link
Author

Actually it turns out there's a bunch more of them which I could list here as well if interested

@Salakar Salakar self-assigned this Aug 31, 2018
@Salakar Salakar added this to the v5.0.0 Release milestone Aug 31, 2018
@Salakar
Copy link
Contributor

Salakar commented Aug 31, 2018

@TrekSoft Yes please, could you list them and I'll restructure the code. Thanks


Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:

@Salakar Salakar added RN-0.57.x Workflow: Waiting for User Response Blocked waiting for user response. Workflow: Needs Review Pending feedback or review from a maintainer. labels Aug 31, 2018
@TrekSoft
Copy link
Author

TrekSoft commented Sep 2, 2018

Thanks so much @Salakar ! Here's what I have:

  • utils\apps.js <> modules\core\app.js
  • modules\admob\index.js <> modules\admob\Interstitial.js
  • modules\admob\index.js <> admob\RewardedVideo.js
  • database\Reference.js <> utils\SyncTree.js
  • modules\core\firebase.js <> utils\apps.js
  • modules\firestore\CollectionReference.js <> modules\firestore\DocumentReference.js
  • \modules\firestore\DocumentReference.js <> \modules\firestore\DocumentSnapshot.js
  • \modules\firestore\DocumentReference.js -> utils\serialize.js -> \modules\firestore\DocumentSnapshot.js -> \modules\firestore\DocumentReference.js
  • modules\storage\index.js -> modules\storage\reference.js -> modules\storage\task.js -> modules\storage\index.js

Thanks again!

@taschik
Copy link

taschik commented Sep 19, 2018

We are running in to the similar error as well:

Require cycle: node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentSnapshot.js -> node_modules/react-native-firebase/dist/modules/firestore/utils/serialize.js -> node_modules/react-native-firebase/dist/modules/firestore/DocumentReference.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

That's our setup here:

    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
      Memory: 985.18 MB / 32.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.10.0 - /usr/local/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
      Android SDK:
        Build Tools: 23.0.1, 25.0.0, 26.0.3, 27.0.3, 28.0.1
        API Levels: 23, 26, 27, 28
    IDEs:
      Android Studio: 3.1 AI-173.4907809
      Xcode: 10.0/10A255 - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.5.2 => 16.5.2
      react-native: ^0.57.0 => 0.57.0
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Firebase:

[email protected]

- Firebase/Core (5.8.1):
    - Firebase/CoreOnly
    - FirebaseAnalytics (= 5.1.4)
  - Firebase/CoreOnly (5.8.1):
    - FirebaseCore (= 5.1.3)
  - Firebase/Messaging (5.8.1):
    - Firebase/CoreOnly
    - FirebaseMessaging (= 3.1.2)
  - FirebaseAnalytics (5.1.4):
    - FirebaseCore (~> 5.1)
    - FirebaseInstanceID (~> 3.2)
    - GoogleAppMeasurement (~> 5.1)
    - GoogleUtilities/AppDelegateSwizzler (~> 5.2)
    - GoogleUtilities/MethodSwizzler (~> 5.2)
    - GoogleUtilities/Network (~> 5.2)
    - "GoogleUtilities/NSData+zlib (~> 5.2)"
    - nanopb (~> 0.3)
  - FirebaseCore (5.1.3):
    - GoogleUtilities/Logger (~> 5.2)
  - FirebaseInstanceID (3.2.1):
    - FirebaseCore (~> 5.1)
    - GoogleUtilities/Environment (~> 5.2)
  - FirebaseMessaging (3.1.2):
    - FirebaseCore (~> 5.0)
    - FirebaseInstanceID (~> 3.0)
    - GoogleUtilities/Reachability (~> 5.2)
    - Protobuf (~> 3.1)

@Salakar
Copy link
Contributor

Salakar commented Sep 20, 2018

These can be ignored for now as it doesn't break anything, the code will be refactored in an upcoming major release to address these warnings.

You can hide them for now if you wish to:

import { YellowBox } from 'react-native';

YellowBox.ignoreWarnings(['Require cycle:']);

@Salakar Salakar modified the milestones: v5.0.0 Release, v5.0.1+ Sep 24, 2018
@aidan-doherty
Copy link

Has this been fixed yet? i am also getting the same yellow warnings.

@aidan-doherty
Copy link

aidan-doherty commented Oct 8, 2018

I have set yellow box to ignore these warnings for now until it is updated. I assume it should be ok if nothing is breaking.

@Salakar Salakar modified the milestones: v5.0.1+, v5.1.0 Oct 21, 2018
@ziyafenn
Copy link

Same problem here. RN 0.57.2

@burtek
Copy link

burtek commented Oct 24, 2018

Can confirm, also getting those

@Salakar Salakar modified the milestones: v5.1.0, v6.0.0 Oct 24, 2018
@jstansbe
Copy link

I'm using core, messaging, and notifications for Android

    "react-native": "0.57.4",
    "react-native-firebase": "^5.0.0"

console output (the below occurs 10 times):

Require cycle: node_modules\react-native-firebase\dist\utils\apps.js -> node_modules\react-native-firebase\dist\modules\core\app.js -> node_modules\react-native-firebase\dist\utils\apps.js

@FadiAboMsalam
Copy link

FadiAboMsalam commented Nov 20, 2018

same problem here

    "react-native": "0.57.3",
   "react-native-firebase": "^5.1.0",

@Salakar
Copy link
Contributor

Salakar commented Nov 27, 2018

See: facebook/metro#287

@MrLoh
Copy link
Contributor

MrLoh commented Dec 20, 2018

I cannot get rid of them in my console. Would be great if this could be fixed, as it really isn't a very good coding practice

@llaine
Copy link

llaine commented Dec 20, 2018

Same problem here:

    "react-native": "0.57.8",
    "react": "16.6.3",
    "react-native-firebase": "^5.0.0",

@radinreth
Copy link

radinreth commented Jan 1, 2019

  • YellowBox are warnings that will be displayed on screen with a yellow background.
    so in this case, I think YellowBox.ignoreWarnings wouldn't help you.

All you need to do to get rid of the warning from console is to patch it in metro
./node_modules/metro/src/lib/polyfills/require.js
because the warning come from there,

Luckily I found Exilz, does this job well.
Feel free to check it out ->

@ospfranco
Copy link
Contributor

Require cycles on their own are not bad, while the warning is justified I think trying to get rid of require cycles completely is a bad idea for most projects, this included, adding it to the ignored list would be my way to go.

@vdlindenmark
Copy link

I'm also getting this on RN0.59... Would be great if this could be fixed.. :-)

@vgm8
Copy link

vgm8 commented Mar 28, 2019

Same here, having the same error in RN0.59

@RWOverdijk
Copy link

Pretty annoying 😄 Anything we can do to help?

@Salakar
Copy link
Contributor

Salakar commented Apr 4, 2019

This has been completely solved in v6 and a drastic internals rework was the only way to solve something like this, unfortunately.

v6 is still WIP but if you're one of the lucky few to only need the Firebase modules listed on the v6 changelog then you can switch to v6 already (instructions on changelog). The modules listed there are ready for use despite their 'alpha' tag on npm as these are more like a 'RC' version - alpha tagged as some modules (the ones not listed there) still need to be migrated to v6 still before it can be released - and all the modules require the same version.

@RWOverdijk
Copy link

I can't wait to use that. I've been waiting for the stack traces... So sexy.

Unfortunately cloud messaging isn't in that list yet.

Thanks for being awesome. 😎

@TrekSoft
Copy link
Author

TrekSoft commented Apr 4, 2019

Thanks so much Salakar! I'm now teaching a college night class on the side with my job at Amazon and have all of them using Firebase with your library since it is by far the easiest and best database integration I know of with mobile.

@asherccohen
Copy link

Hi, is this issue now resolved or should we wait for v6?

@mikehardy

This comment has been minimized.

@Salakar

This comment has been minimized.

@stale
Copy link

stale bot commented Jun 23, 2019

Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the Type: Stale Issue has become stale - automatically added by Stale bot label Jun 23, 2019
@Ehesp
Copy link
Member

Ehesp commented Jun 24, 2019

FYI this will be fixed in v6 which is currently in progress.

@stale stale bot removed the Type: Stale Issue has become stale - automatically added by Stale bot label Jun 24, 2019
@SaeedZhiany
Copy link
Contributor

@Salakar
Here is the list of cycles warning I'm getting, it may be helpful cause I didn't see more of them in the other comments.

Require cycle: node_modules\react-native-firebase\dist\utils\apps.js -> node_modules\react-native-firebase\dist\modules\core\app.js -> node_modules\react-native-firebase\dist\utils\apps.js

Require cycle: node_modules\react-native-firebase\dist\modules\admob\index.js -> node_modules\react-native-firebase\dist\modules\admob\Interstitial.js -> node_modules\react-native-firebase\dist\modules\admob\index.js

Require cycle: node_modules\react-native-firebase\dist\modules\admob\index.js -> node_modules\react-native-firebase\dist\modules\admob\RewardedVideo.js -> node_modules\react-native-firebase\dist\modules\admob\index.js

Require cycle: node_modules\react-native-firebase\dist\modules\database\Reference.js -> node_modules\react-native-firebase\dist\utils\SyncTree.js -> node_modules\react-native-firebase\dist\modules\database\Reference.js

Require cycle: node_modules\react-native-firebase\dist\modules\core\firebase.js -> node_modules\react-native-firebase\dist\utils\apps.js -> node_modules\react-native-firebase\dist\modules\core\app.js -> node_modules\react-native-firebase\dist\modules\database\index.js -> node_modules\react-native-firebase\dist\modules\core\firebase.js

Require cycle: node_modules\react-native-firebase\dist\modules\firestore\DocumentSnapshot.js -> node_modules\react-native-firebase\dist\modules\firestore\DocumentReference.js -> node_modules\react-native-firebase\dist\modules\firestore\DocumentSnapshot.js

Require cycle: node_modules\react-native-firebase\dist\modules\firestore\CollectionReference.js -> node_modules\react-native-firebase\dist\modules\firestore\Query.js -> node_modules\react-native-firebase\dist\modules\firestore\QuerySnapshot.js -> node_modules\react-native-firebase\dist\modules\firestore\DocumentChange.js -> node_modules\react-native-firebase\dist\modules\firestore\DocumentSnapshot.js -> node_modules\react-native-firebase\dist\modules\firestore\DocumentReference.js -> node_modules\react-native-firebase\dist\modules\firestore\CollectionReference.js

Require cycle: node_modules\react-native-firebase\dist\modules\firestore\DocumentReference.js -> node_modules\react-native-firebase\dist\modules\firestore\utils\serialize.js -> node_modules\react-native-firebase\dist\modules\firestore\DocumentReference.js

Require cycle: node_modules\react-native-firebase\dist\modules\firestore\utils\serialize.js -> node_modules\react-native-firebase\dist\modules\firestore\FieldValue.js -> node_modules\react-native-firebase\dist\modules\firestore\utils\serialize.js

Require cycle: node_modules\react-native-firebase\dist\modules\core\firebase.js -> node_modules\react-native-firebase\dist\utils\apps.js -> node_modules\react-native-firebase\dist\modules\core\app.js -> node_modules\react-native-firebase\dist\modules\functions\index.js -> node_modules\react-native-firebase\dist\modules\core\firebase.js

Require cycle: node_modules\react-native-firebase\dist\modules\storage\index.js -> node_modules\react-native-firebase\dist\modules\storage\reference.js -> node_modules\react-native-firebase\dist\modules\storage\task.js -> node_modules\react-native-firebase\dist\modules\storage\index.js

@Salakar
Copy link
Contributor

Salakar commented Jul 2, 2019

Thanks @SaeedZhiany - these have all been sorted in the upcoming v6 release

@Ehesp
Copy link
Member

Ehesp commented Jul 2, 2019

Pushed up the v6 Firestore changes for this earlier today.

@stale
Copy link

stale bot commented Jul 30, 2019

Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the Type: Stale Issue has become stale - automatically added by Stale bot label Jul 30, 2019
@Ehesp Ehesp closed this as completed Jul 31, 2019
@ketan1062
Copy link

having the same error in RN0.61.2

@Ehesp
Copy link
Member

Ehesp commented Nov 7, 2019

v6 has been released for a few months now with this fix.

@mikehardy mikehardy removed the Workflow: Needs Review Pending feedback or review from a maintainer. label Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: firestore Firebase Cloud Firestore Type: Stale Issue has become stale - automatically added by Stale bot Workflow: Waiting for User Response Blocked waiting for user response.
Projects
None yet
Development

No branches or pull requests