Cypress 16 Chrome native network: `cy.wait()` on a fetch form POST answered with 302 yields `response` undefined after "Timed out waiting for CDP Fetch response pause"
Current behavior
Current behavior
On Cypress 16.1.0 in Chrome, a plain cy.intercept().as() spy on a form submission that the page sends with fetch() (Hotwire Turbo Drive form submit, redirect: 'follow') and that the server answers with 302 Location: … never receives the response on the native network path.
cy.wait('@alias') resolves only after ~30 seconds, with interception.response undefined and interception.error set to:
Timed out waiting for CDP Fetch response pause for https://<app>/parents/<id>/childrenThe browser completed the request. The Command Log shows the (fetch) POST /parents/<id>/children entry with status 200 (the final status after following the 302), then (new url) as Turbo renders the redirected page, then follow-up *.turbo_stream GETs with 200. The application ends up in the correct state; only the intercepted response is missing, so the assertion fails:
AssertionError: Timed out retrying after 45000ms: expected undefined to equal 302Diagnostics logged from inside the cy.wait() callback of the failing run (interception fields serialised with JSON.stringify):
{
"cypressVersion": "16.1.0",
"browser": "Custom Chrome for Testing",
"browserVersion": "154.0.8037.57",
"interceptionId": "interceptedRequest175",
"method": "POST",
"url": "https://<app>/parents/<id>/children",
"expectedStatusCode": 302,
"responsePresent": false,
"statusCode": null,
"location": null,
"error": {
"name": "Error",
"message": "Timed out waiting for CDP Fetch response pause for https://<app>/parents/<id>/children"
}
}Notes:
- The same spec and application passed on Cypress 15.x, which used the legacy proxy path for Chrome.
forceHttp1: trueis the documented way back to that path and is the workaround we are applying. - The intercept has no request or response handler. It is a spy with
.as()only. - The redirect is same-origin, a standard Rails
redirect_toafter a successful POST. - The 30 second delay and the message match the
RESPONSE_PAUSE_TIMEOUT_MSrace inpackages/server/lib/browsers/cdp-protocol/cdp-fetch-transport.ts, so no response-stageFetch.requestPausedwas matched for this hop. This looks related to #34689 (no response pause → 30s timeout instead of the browser's reason) and #34704 (redirect-received pauses in Chrome). - Plain GET waits in the same suite, including Turbo visits without a redirect, resolve normally on the native path. Only fetch POSTs that redirect are affected.
Desired behavior
cy.wait('@alias') should yield the 302 response (status code and location header) for the POST hop, as it does on Cypress 15 and on the forceHttp1 path, without a 30 second stall. If Chrome emits no response-stage pause for this hop, the interception should at least resolve promptly with the browser's reason instead of the timeout.
Desired behavior
No response
Test code to reproduce
Test code to reproduce
The application is private (Rails 7 + Hotwire Turbo), so these are the exact test code and the steps for a minimal project.
Test code:
cy.intercept('POST', new RegExp(`${baseUrl}/parents/[0-9a-f-]{36}/children$`)).as('createChild');
cy.get('input[type="submit"]').click();
cy.wait('@createChild', { timeout: 90000 })
.its('response.statusCode')
.should('eq', 302);What the page does on click: Turbo Drive intercepts the <form method="post"> submit and sends it with fetch(url, { method: 'POST', redirect: 'follow', headers: { Accept: 'text/vnd.turbo-stream.html, text/html' } }). The server responds 302 with Location: /parents/<id>. The browser follows to a 200 text/html page, Turbo renders it and calls history.pushState.
Steps to reproduce in a minimal project:
- Serve a page with a button whose click handler runs
fetch('/submit', { method: 'POST', redirect: 'follow' }). - Have
POST /submitanswer302 Location: /done, andGET /doneanswer200 text/html. - In a spec:
cy.intercept('POST', '/submit').as('submit'), click the button, thency.wait('@submit').its('response.statusCode').should('eq', 302). - Run in Chrome with default config (
forceHttp1unset). Expected: passes. Observed on our app:cy.waitresolves after ~30s withresponseundefined and the error above.
Config in use:
export default defineConfig({
e2e: {
defaultBrowser: 'chrome',
chromeWebSecurity: true,
injectDocumentDomain: true,
defaultCommandTimeout: 45000,
},
});Cypress Version
16.1.0 (package and binary). Passed on Cypress 15.x before the upgrade.
Node version
24.19.0
Operating System
Ubuntu 26.04.1 LTS (local run). Also fails nightly on GitHub Actions ubuntu-latest with Chrome 154 pinned via browser-actions/setup-chrome.
Cypress Version
16.1.0
Debug Logs
Command Log of the failing step (Cypress 16.1.0, Chrome for Testing 154.0.8037.57):
Then the new child form should be open
url
assert expected https://<app>/parents/<id>/children/new?group=<name> to include children/new
location search
assert expected <name> to equal <name>
When the user submits the form
get input[type="submit"]
click
(fetch) POST 200 /parents/<id>/children createChild_1790194845120
wait @createChild_1790194845120
log POST DEBUG { "cypressVersion": "16.1.0", "browser": "Custom Chrome for Testing", "browserVersion": "154.0.8037.57", "interceptionId": "interceptedRequest175", "method": "POST", "url": "https://<app>/parents/<id>/children", "expectedStatusCode": 302, "responsePresent": false, "statusCode": null, "location": null, "error": { "name": "Error", "message": "Timed out waiting for CDP Fetch response pause for https://<app>/parents/<id>/children" } }
its .response.statusCode
assert expected undefined to equal 302
(fetch) GET /parents/<id>
(new url) https://<app>/parents/<id>
(fetch) GET 200 /parents/<id>/children.turbo_stream
(fetch) GET 200 /parents/<id>/section_a.turbo_stream
(fetch) GET 200 /parents/<id>/section_b.turbo_stream
AssertionError
Timed out retrying after 45000ms: expected undefined to equal 302
Stack trace
at FormPage.submit (…/cypress/e2e/<spec>.feature:23848:41)
at FormPage.clickSubmit (…:23851:16)
at Context.eval (…:24083:24)
at Registry.runStepDefinition (…:9411:48)
at Object.fn (…:12640:42)
at runStepWithLogGroup (…:11370:29)
`DEBUG=cypress:*` server logs were not captured for this run. Happy to attach them on request.Other
- Browser: Chrome for Testing 154.0.8037.57, passed to Cypress via
--browser <path>. Same behaviour with the Chrome installed bybrowser-actions/setup-chromein CI. - Preprocessor:
@badeball/cypress-cucumber-preprocessorwith esbuild. The intercept and wait run inside a step definition, but nothing in the flow depends on Cucumber. - The suite has roughly 90
cy.wait(alias).its('response.statusCode')assertions. Only those on redirecting fetch form POSTs fail on the native path. - Workaround:
forceHttp1: true.
Source: cypress-io/cypress