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.

Possible regression in Cypress 9.1: `TypeError: data.hasOwnProperty is not a function`

See original GitHub issue

Current behavior

We’re running a series of tests against our production application using Cypress. The runner is using the cypress/browsers:node16.5.0-chrome94-ff93 Docker image. All of our tests fail with a similar stacktrace and none of the lines include our own test code. This suite runs successfully in Cypress 9.0.

Here’s the failure we get on almost all of the specs in our suite:

TypeError: data.hasOwnProperty is not a function
--
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:39:22)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:32:26)
  | at Object.deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:16:17)
  | at Encoder.encodeAsBinary (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/index.js:80:41)
  | at Encoder.encode (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/index.js:42:29)
  | at Client._packet (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/client.js:169:44)
  | at Socket.packet (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:160:21)
  | at /root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:274:18
  | at /root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/lib/socket-base.js:318:28
  | at tryCatcher (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
  | at Promise._settlePromiseFromHandler (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
  | at Promise._settlePromise (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
  | at Promise._settlePromise0 (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
  | at Promise._settlePromises (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18)
  | at _drainQueueStep (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
  | at _drainQueue (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
  | at Async._drainQueues (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
  | at Immediate.Async.drainQueues [as _onImmediate] (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
  | at processImmediate (node:internal/timers:464:21)
  |  
  | TypeError: data.hasOwnProperty is not a function
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:39:22)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:40:32)
  | at _deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:32:26)
  | at Object.deconstructPacket (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/binary.js:16:17)
  | at Encoder.encodeAsBinary (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/index.js:80:41)
  | at Encoder.encode (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io-parser/dist/index.js:42:29)
  | at Client._packet (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/client.js:169:44)
  | at Socket.packet (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:160:21)
  | at /root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:274:18
  | at /root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/lib/socket-base.js:318:28
  | at tryCatcher (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
  | at Promise._settlePromiseFromHandler (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
  | at Promise._settlePromise (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
  | at Promise._settlePromise0 (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
  | at Promise._settlePromises (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18)
  | at _drainQueueStep (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
  | at _drainQueue (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
  | at Async._drainQueues (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
  | at Immediate.Async.drainQueues [as _onImmediate] (/root/.cache/Cypress/9.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
  | at processImmediate (node:internal/timers:464:21)
  |  
  | [502:1124/150621.083113:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
  | [502:1124/150621.084970:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
  | [502:1124/150621.085005:ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon
  | [666:1124/150621.113215:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is

Desired behavior

We’re just looking to figure out what changed from 9.0 -> 9.1 to cause this issue. We’re able to run these tests locally, but they fail in

Test code to reproduce

  it('Home page - shows expected content', () => {
    cy.visit('/');

    cy.contains('Making millions of students better readers and writers');
  });

Our base URL is www.commonlit.org.

Cypress Version

9.1.0

Other

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
cexbrayatcommented, Nov 25, 2021

We do also hit this issue in v9.1. After investigation, it only appears in our projects that use @percy/cypress. Is that the case for you @geoffharcourt ?

See https://github.com/percy/percy-cypress/issues/434 for the percy/cypress issue

2reactions
Robdel12commented, Dec 2, 2021

I spent some time digging in to try and isolate & reproduce.

describe("Breaking reproduction", function () {
  it("doesn't throw an error when making requests", function () {
    cy.then(() =>
      Cypress.backend("http:request", {
        url: "http:localhost:8001/nothing/here",
        method: "POST",
      })
    );
  });
});

This will break with the same stack trace in the OP.

Read more comments on GitHub >

github_iconTop Results From Across the Web

hasOwnProperty is not a function in Node.js?
A way around the error is to call hasOwnProperty on Object explicitly, and bind it to the object, like so: // Calls "hasOwnProperty"...
Read more >
Changelog
Fixed a regression introduced in the Electron browser in Cypress 10.8.0 where the CYPRESS_EVERY_NTH_FRAME environment variable was not being set appropriately ...
Read more >
cypress 9.1.1 on Node.js NPM
New release cypress version 9.1.1 on Node.js NPM. ... A TypeError displaying data.hasOwnProperty is not a function will no longer throw in some...
Read more >
react-select-no-emotion/HISTORY.md
The CDN for react-select-no-emotion.
Read more >
cypress: Versions
A TypeError displaying data.hasOwnProperty is not a function will no longer throw in some situations. Fixes #19091. Empty extra hooks will no longer...
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