Cypress v5.4.0 but might happen earlier

Reproducible example in https://github.com/cypress-io/cypress-example-recipes
Spec examples/stubbing-spying__route2/cypress/integration/image-spec.js
Test
it('redirects static image', () => {
// instead of serving an image from a fixture
// we can redirect the request for the image
// to another route
cy.route2({
method: 'GET',
url: '/images/tiger.jpg',
}, (req) => {
// /__root/* is a special URL that can serve a file from the
// project's root. Normally this is used during bundling
// but here we are using it to serve another image
req.redirect('/__root/cypress/fixtures/roo.jpg')
})
cy.visit('/pics.html')
})
Error screenshot

Last stack frame

request is undefined

Previous stack frame
request is undefined and calls sendContinuationFrame (where it crashes trying to set request)
@bahmutov
I can also confirm! 馃悰
Bumped into this issue in v5.3.0 and v5.4.0 when using .route2 attempting to add custom headers to all requests!

The code for this is done in cypress-io/cypress#8965, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Released in 5.5.0.
This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v5.5.0, please open a new issue.
Most helpful comment
@bahmutov
I can also confirm! 馃悰
Bumped into this issue in v5.3.0 and v5.4.0 when using
.route2attempting to add custom headers to all requests!