From 4d0a604ffff893d8c9160a30cb9d9b5e4305f4c9 Mon Sep 17 00:00:00 2001 From: Matthew Schile Date: Wed, 3 Dec 2025 14:17:46 -0700 Subject: [PATCH 1/3] doc: add docs for synchronous XHR requests --- docs/app/references/error-messages.mdx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/app/references/error-messages.mdx b/docs/app/references/error-messages.mdx index e92d3b5380..11a5794ed0 100644 --- a/docs/app/references/error-messages.mdx +++ b/docs/app/references/error-messages.mdx @@ -801,10 +801,10 @@ read a unique identifier from your CI provider as described in our You may encounter this error if Cypress is detecting the exact same CI Build ID matching a previous CI Build ID in a run that was completed over 24 hours ago. -You cannot run tests on a run that has been complete for that long. ​ ​You can +You cannot run tests on a run that has been complete for that long. You can see the CI Build ID that is detected for each completed run by looking at the details section at the top of your run in -[Cypress Cloud](https://on.cypress.io/cloud). ​ ​You can generate and pass in +[Cypress Cloud](https://on.cypress.io/cloud). You can generate and pass in your own unique CI Build ID per run as described [here](/app/references/command-line#cypress-run-ci-build-id-lt-id-gt). @@ -946,6 +946,22 @@ there. It's possible to enable debugging these scripts by adding the `crossorigin` attribute and setting a `CORS` header. +### Synchronous XHR requests + +:::caution + +Note + +Synchronous XHR requests often cause hangs on the web, especially with poor network conditions or when the remote server is slow to respond. Synchronous XHR is now deprecated and should be avoided in favor of asynchronous requests. + +::: + +Cypress does not fully support synchronous XHR requests in the following scenarios: + +- When using `cy.intercept()` with a `routeHandler` to intercept a synchronous XHR request. +- When applying cookies to a synchronous XHR request. +- When setting cookies from the response of a synchronous XHR request. + ## Browser Errors {/* keep old hash */} From e77676ccb7dd846d7b267bf7b3ec2e3ce4843740 Mon Sep 17 00:00:00 2001 From: Matthew Schile Date: Wed, 3 Dec 2025 15:20:37 -0700 Subject: [PATCH 2/3] updates --- docs/app/references/error-messages.mdx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/app/references/error-messages.mdx b/docs/app/references/error-messages.mdx index 11a5794ed0..9af959d37c 100644 --- a/docs/app/references/error-messages.mdx +++ b/docs/app/references/error-messages.mdx @@ -956,11 +956,21 @@ Synchronous XHR requests often cause hangs on the web, especially with poor netw ::: -Cypress does not fully support synchronous XHR requests in the following scenarios: +When using synchronous XHR requests, you may see the following warnings: -- When using `cy.intercept()` with a `routeHandler` to intercept a synchronous XHR request. -- When applying cookies to a synchronous XHR request. -- When setting cookies from the response of a synchronous XHR request. +> **Warning: Synchronous XHR request was not intercepted: http://example.com.** + +Cypress is unable to intercept a synchronous XHR request if the [`cy.intercept()`](/api/commands/intercept) is using a [`routeHandler`](/api/commands/intercept#routeHandler-Function). +Thus, the [`routeHandler`](/api/commands/intercept#routeHandler-Function) won't be executed and the request will be sent to the origin server without any modifications. +An intercept with a [`StaticResponse`](/api/commands/intercept#staticResponse-StaticResponse) does not have this limitation and will still be executed. + +> **Warning: Cookies may not have been applied to synchronous XHR request: http://example.com.** + +Cypress is unable to apply cookies to a synchronous XHR request if the request is cross-origin to the `top` origin. + +> **Warning: Cookies may not have been set for synchronous XHR response: http://example.com.** + +Cypress is unable to set cookies for a synchronous XHR response if the request is cross-origin to the `top` origin. ## Browser Errors From 7b5cba7b22e37a42a9bb7d8e0adf2009c3e8b6d4 Mon Sep 17 00:00:00 2001 From: Matthew Schile Date: Mon, 8 Dec 2025 09:12:29 -0700 Subject: [PATCH 3/3] fix lint --- docs/app/references/error-messages.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/app/references/error-messages.mdx b/docs/app/references/error-messages.mdx index 9af959d37c..6cd0c5b491 100644 --- a/docs/app/references/error-messages.mdx +++ b/docs/app/references/error-messages.mdx @@ -960,8 +960,8 @@ When using synchronous XHR requests, you may see the following warnings: > **Warning: Synchronous XHR request was not intercepted: http://example.com.** -Cypress is unable to intercept a synchronous XHR request if the [`cy.intercept()`](/api/commands/intercept) is using a [`routeHandler`](/api/commands/intercept#routeHandler-Function). -Thus, the [`routeHandler`](/api/commands/intercept#routeHandler-Function) won't be executed and the request will be sent to the origin server without any modifications. +Cypress is unable to intercept a synchronous XHR request if the [`cy.intercept()`](/api/commands/intercept) is using a [`routeHandler`](/api/commands/intercept#routeHandler-Function). +Thus, the [`routeHandler`](/api/commands/intercept#routeHandler-Function) won't be executed and the request will be sent to the origin server without any modifications. An intercept with a [`StaticResponse`](/api/commands/intercept#staticResponse-StaticResponse) does not have this limitation and will still be executed. > **Warning: Cookies may not have been applied to synchronous XHR request: http://example.com.**