Cypress: Cannot set property response of undefined

Created on 15 Oct 2020  路  3Comments  路  Source: cypress-io/cypress

Cypress v5.4.0 but might happen earlier

route2-flake

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

  • checks if request is undefined and calls sendContinuationFrame (where it crashes trying to set request)

internal-priority pknet-stubbing bug

Most helpful comment

@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!

image

All 3 comments

@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!

image

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Francismb picture Francismb  路  3Comments

carloscheddar picture carloscheddar  路  3Comments

igorpavlov picture igorpavlov  路  3Comments

jennifer-shehane picture jennifer-shehane  路  3Comments

jennifer-shehane picture jennifer-shehane  路  3Comments