Maximum call stack size exceeded when SignalsPlugin and DataDog RUM are both active
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
Research direction
Start at the Signals constructor where NetworkGenerator is registered and trace the SignalsPlugin configuration path. Check how the proposed disableNetworkSignals option should reach that registration, then verify that fetch no longer recurses with DataDog RUM while interaction and navigation signals remain enabled.
Written by the indexing model from the issue text.
Description
When using SignalsPlugin alongside DataDog RUM (@datadog/browser-rum), the app crashes with:
RangeError: Maximum call stack size exceeded
This is caused by infinite recursion between the two libraries’ fetch instrumentation.
❗ Error
RangeError: Maximum call stack size exceeded
at interceptedFetch (@segment/analytics-signals)
at instrumentation (@datadog/browser-rum)
at interceptedFetch (@segment/analytics-signals)
at instrumentation (@datadog/browser-rum)
... (repeats infinitely)
🔁 Steps to Reproduce
-
Install Segment packages:
npm install @segment/analytics-next @segment/analytics-signals -
Install DataDog RUM:
npm install @datadog/browser-rum -
Initialize both:
Segment with SignalsPlugin
const analytics = new AnalyticsBrowser();
await analytics.load({
writeKey: 'xxx',
plugins: [new SignalsPlugin()],
});
DataDog RUM
datadogRum.init({
applicationId: 'xxx',
clientToken: 'xxx',
trackResources: true, // default
});
- App crashes immediately with a stack overflow.
🔍 Root Cause
Both libraries wrap the global fetch API.
When a fetch call is made, each wrapper calls the other in an infinite loop.
The NetworkGenerator is registered unconditionally in the Signals constructor:
void this.registerGenerator([...domGenerators, new NetworkGenerator()]);
The existing config options (networkSignalsAllowSameDomain, networkSignalsAllowList, etc.) only filter which signals are emitted — the fetch wrapper is still installed and causes the conflict.
🛠️ Workaround
We’re using patch-package to remove NetworkGenerator from the registered generators:
- void this.registerGenerator([...domGenerators, new NetworkGenerator()]);
+ void this.registerGenerator([...domGenerators]);
This disables network signals but keeps interaction and navigation signals working.
💡 Suggested Fix
Add a configuration option to disable network signal generation entirely:
new SignalsPlugin({
disableNetworkSignals: true,
});
This would skip registering NetworkGenerator, avoiding conflicts with other tools that instrument fetch (DataDog, Sentry, New Relic, etc.).
🧪 Environment
@segment/analytics-signals: 2.4.4@segment/analytics-next: 1.76.0@datadog/browser-rum: 5.x
- Dominant language
- TypeScript
- Stars
- 477
- Forks
- 160
- Avg merge
- 6h 19m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from segmentio/analytics-next
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
segmentio/analytics-next#1324 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
segmentio/analytics-next#1366 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
segmentio/analytics-next#1338 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
segmentio/analytics-next#1332 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
segmentio/analytics-next#1331 ·
All issues in segmentio/analytics-next
Similar issues
-
comp/dashboard P3 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
NousResearch/hermes-agent#117722 ·
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·