cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.04k stars 3.18k forks source link

"RangeError: The value of "offset" is out of range." while capturing screenshot #30603

Open sawsubir opened 2 days ago

sawsubir commented 2 days ago

Current behavior

While capturing screenshot of a screenshot using cy.screenshot(), cypress runs into an exception "RangeError: The value of "offset" is out of range. It must be >= 0 and <= 2974716. Received 2977760". The test is capturing a screenshot of one of the elements with in the DOM. It works fine for other elements where screenshots are being captured but it is throwing an exception here.

Note that the test is running in headless mode on chrome v130.

Here is the stack trace

  _RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 2974716. Received 2977760
      at new NodeError (node:internal/errors:405:5)
      at boundsError (node:internal/buffer:88:9)
      at Buffer.readUInt32BE (node:internal/buffer:311:5)
      at q.<anonymous> (<embedded>:478:177535)
      at e.scan (<embedded>:476:671622)
      at q.scanQuiet (<embedded>:478:69172)
      at q.cropQuiet (<embedded>:478:177475)
      at I.q.<computed> [as crop] (<embedded>:478:65783)
      at A (<embedded>:2793:89146)
      at <unknown> (<embedded>:2793:92977)
      at tryCatcher (/users/ukcam/subsaw/.cache/Cypress/13.15.2/Cypress/resources/app/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/users/ukcam/subsaw/.cache/Cypress/13.15.2/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:512:31)
      at Promise._settlePromise (/users/ukcam/subsaw/.cache/Cypress/13.15.2/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:569:18)
      at Promise._settlePromise0 (/users/ukcam/subsaw/.cache/Cypress/13.15.2/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:614:10)
      at Promise._settlePromises (/users/ukcam/subsaw/.cache/Cypress/13.15.2/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:694:18)
      at _drainQueueStep (/users/ukcam/subsaw/.cache/Cypress/13.15.2/Cypress/resources/app/node_modules/bluebird/js/release/async.js:138:12)
      at _drainQueue (/users/ukcam/subsaw/.cache/Cypress/13.15.2/Cypress/resources/app/node_modules/bluebird/js/release/async.js:131:9)
      at Async._drainQueues (/users/ukcam/subsaw/.cache/Cypress/13.15.2/Cypress/resources/app/node_modules/bluebird/js/release/async.js:147:5)
      at Immediate._onImmediate (/users/ukcam/subsaw/.cache/Cypress/13.15.2/Cypress/resources/app/node_modules/bluebird/js/release/async.js:17:14)_

Desired behavior

The screenshot capture should work.

Test code to reproduce

I cannot recreate the exception using a publicly available web application.

Cypress Version

13.15.2

Node version

20.18.0

Operating System

NAME="Red Hat Enterprise Linux" VERSION="8.10 (Ootpa)"

Debug Logs

Refer to https://pastebin.com/AS1EXqrt

Other

No response

jennifer-shehane commented 2 days ago

@sawsubir We haven't seen this issue in a while. Can you provide a reproducible example?