question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RangeError: Maximum call stack size exceeded when making cy.request which times out

See original GitHub issue

Current behavior

When making cy.request(url) to the endpoint which does not respond in 30 seconds (default response timeout), cypress crashes with RangeError: Maximum call stack size exceeded error in socket.io-parser, used by bluebird library.

Desired behavior

cy.request(url) should fail the test instead of crashing the cypress.

Test code to reproduce

spec.js:

/// <reference types="cypress" />

context('Network Requests', () => {
  it('cy.request() - make an XHR request', () => {
    // https://on.cypress.io/request
    cy.request('http://localhost:8080').then(r => {
      cy.wrap(r.body).should('contain', 'Hello');
    })
  })
})

server.js:

const express = require('express');
const app = express();

app.get('/', async (req, res) => {
  await sleep(50000);
  res.send('Hello from App Engine!');
});

// Listen to the App Engine-specified port, or 8080 otherwise
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
  console.log(`Server listening on port ${PORT}...`);
});

function sleep(ms) {
    return new Promise((resolve) => {
      setTimeout(resolve, ms);
    });
  } 

Versions

Definitely 6.6.0 and 6.8.0, possibly earlier.

Callstack

RangeError: Maximum call stack size exceeded
    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:21:28)
    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)

... 15k lines omitted ...

    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:40:32)
    at _deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:32:26)
    at Object.deconstructPacket (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\binary.js:16:17)
    at Encoder.encodeAsBinary (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\index.js:81:41)
    at Encoder.encode (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io-parser\dist\index.js:43:29)
    at Client._packet (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\client.js:167:44)
    at Socket.packet (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\socket.js:161:21)
    at C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\socket\node_modules\socket.io\dist\socket.js:270:18
    at C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\lib\socket-base.js:304:28
    at tryCatcher (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:725:18)
    at _drainQueueStep (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:93:12)
    at _drainQueue (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:86:9)
    at Async._drainQueues (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\Tests\AppData\Local\Cypress\Cache\6.6.0\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:15:14)
    at processImmediate (internal/timers.js:456:21)

Edit: Changed r.body.should('contain', 'Hello'); to cy.wrap(r.body).should('contain', 'Hello');

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:29 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jennifer-shehanecommented, Apr 27, 2021

Duplicate of https://github.com/cypress-io/cypress/issues/15101 which we have a reproducible example for now.

@t00 I could also get yours to reproduce after a few tries of stop/starting.

Closing as Duplicate to track in one issue.

1reaction
t00commented, Apr 20, 2021

@DVGY Looks like @bahmutov is from the cypress team and hopefully might be able to help 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress fails with Maximum call stack size exceeded ... - GitHub
But I suspect the "Maximum call stack size exceeded" is the real problem. Sometimes this works fine, and sometimes it fails. There doesn't...
Read more >
JavaScript Error: Maximum Call Stack Size Exceeded
This error is a RangeError. A RangeError typically means an error has occurred outside of a code's argument value for its parameter. Now...
Read more >
Cypress Test fails with a RangeError - Stack Overflow
I am currently trying to use cypress to test my application. ... Error: RangeError: Maximum call stack size exceeded at Object.
Read more >
cypress-io/cypress - Gitter
Having issues after I updated from Cypress 3.3.1 to 3.4.1. I am getting "Uncaught RangeError: Maximum call stack size exceeded." all over the...
Read more >
JavaScript RangeError: Maximum Call Stack Size Exceeded
The RangeError: Maximum call stack size exceeded is thrown when a function call is made that exceeds the call stack size. This can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found