🐛 tolerate Cypress.env throwing under allowCypressEnv: false#4550
Merged
🐛 tolerate Cypress.env throwing under allowCypressEnv: false#4550
Conversation
Swallow the throw and warn customers to upgrade dd-trace-js to >= 5.88.0 so RUM ↔ test correlation keeps working as Cypress moves toward removing Cypress.env.
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: ac47794 | Docs | Datadog PR Page | Give us feedback! |
juan-fernandez
approved these changes
Apr 30, 2026
amortemousque
approved these changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
A telemetry error is observed in customer data:
The SDK reads
window.Cypress.env('traceId')at boot inciVisibilityContext.tsas a secondary transport for the CI Visibility test execution id (the primary is thedatadog-ci-visibility-test-execution-idcookie). Under Cypress 15.10+ withallowCypressEnv: false, the call itself throws regardless of whether a value was set.The legacy env path is still used: it serves customers on
dd-trace-js < 5.88.0(where the plugin still wrote viaCypress.env). Removing the read would silently break correlation for them.Changes
Cypress.env('traceId')read in try/catch inciVisibilityContext.tsso the throw no longer bubbles updisplay.warn(...)only when the env read actually throws, prompting customers to upgradedd-trace-js >= 5.88.0(the version that switched the writer to the cookie via dd-trace-js#7600).Test instructions
yarn test:unit --spec packages/rum-core/src/domain/contexts/ciVisibilityContext.spec.ts— 9 specs pass (5 existing + 4 new).Checklist