question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Require cycle fetch

See original GitHub issue

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which SDK and version?

"@sentry/react-native": "^3.2.13",
"@sentry/node": "^6.17.8",
"@sentry/tracing": "^6.17.8",

Steps to Reproduce

  1. Install sentry and setup according to docs
  2. Run app

Expected Result

No require cycle upon running the app

Actual Result

Getting a require cycle warning from sentry-react-native:

Require cycle: node_modules\react-native\Libraries\Network\fetch.js -> node_modules\whatwg-fetch\dist\fetch.umd.js -> node_modules\react-native\Libraries\Network\fetch.js

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
AbhiPrasadcommented, Apr 6, 2022

We currently don’t have the cycles to investigate as we are focusing on the major JS SDK bump.

The major version does change how transports work, so let’s re-visit this after that!

1reaction
jennmuengcommented, Mar 24, 2022

Ok after further investigation here are the lines that triggers the require cycle. when the browser backend calls supportsFetch().

I assume it’s something with how React Native lazy-initializes some functionality and fetch seems to be one of them. The line calling new Headers() triggers the polyfill from whatwg-fetch to be run, which leads to the require cycle. The warning does not show if you trigger the lazy initialized fetch beforehand by adding a fetch call before

fetch("").catch((e) => {});

Also, calling new Headers() or any of the others later in the lifecycle of the app poses no issue. Which means for some reason our SDK is getting initialized very early on before the fetch polyfill I assume is eventually called by default?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning 'Require cycle' between fetch.js & whatwg ... - GitHub
Description. Working with react-native@0.57.7 , I encounter this warning: Require cycle: node_modules\react-native\ ...
Read more >
Trying to use fetch results in "Require cycle..." : r/reactnative
I'm not doing anything special, i'm simply trying to use fetch to perform a network request, but that results in a HUGE warning...
Read more >
Require cycles are allowed, but can result in uninitialized ...
js This is what triggers the Require cycle warning because a module that was imported from one place, is then rendering and asking...
Read more >
Trying to use fetch results in "Require cycle..." | JavaScript LibHunt
Doing some googling I arrive at this issue: github.com/facebook/react-native/issues/23130 which is closed and locked and points to this issue ...
Read more >
require cycle node_modules/rn-fetch-blob/index.js
Modify these files can avoid require cycle: // IN DIR rn-fetch-blob/polyfill // all thease 4 files: Blob.js, Fetch.js, FileReader.js, XMLHttpRequest.js ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found