Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set property response of undefined #8858

Closed
bahmutov opened this issue Oct 15, 2020 · 3 comments · Fixed by #8965
Closed

Cannot set property response of undefined #8858

bahmutov opened this issue Oct 15, 2020 · 3 comments · Fixed by #8965

Comments

@bahmutov
Copy link
Contributor

bahmutov commented Oct 15, 2020

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)

@ghost
Copy link

ghost commented Oct 21, 2020

@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

@cypress-bot cypress-bot bot added stage: work in progress There is an open PR for this issue [WIP] stage: needs review The PR code is done & tested, needs review and removed stage: work in progress There is an open PR for this issue [WIP] labels Oct 26, 2020
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Oct 26, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 26, 2020

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.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 27, 2020

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.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Oct 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants