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.

Fails to POST DOM snapshot to CLI server: `TypeError: Cannot read property 'end' of undefined`

See original GitHub issue

Percy snapshot seems to be failing with the following error

CypressError: cy.then()timed out after waiting15000ms`.

Your callback function returned a promise that never resolved.

The callback function was:

async () => { if (Cypress.config(‘isInteractive’) && !Cypress.config(‘enablePercyInteractiveMode’)) { return cylog(‘Disabled in interactive mode’, { details: ‘use “cypress run” instead of “cypress open”’, name }); }

// Check if Percy is enabled
if (!await utils.isPercyEnabled()) {
  return cylog('Not running', { name });
}

// Inject @percy/dom
if (!window.PercyDOM) {
  // eslint-disable-next-line no-eval
  eval(await utils.fetchPercyDOM());
}

// Serialize and capture the DOM
return cy.document({ log: false }).then(dom => {
  let domSnapshot = window.PercyDOM.serialize({ ...options, dom });

  // Post the DOM snapshot to Percy
  return utils.postSnapshot({
    ...options,
    environmentInfo: ENV_INFO,
    clientInfo: CLIENT_INFO,
    domSnapshot,
    url: dom.URL,
    name
  }).then(() => {
    // Log the snapshot name on success
    cylog(name, { name });
  }).catch(error => {
    // Handle errors
    log.error(`Could not take DOM snapshot "${name}"`);
    log.error(error);
  });
});

}

https://on.cypress.io/then`

Code: cy.visit('/') cy.url().should('include', '/auth/signup') cy.percySnapshot()

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
aleksandrlatcommented, Jun 28, 2021

On different CircleCI tab I see the same error coming from Cypress from all failing tests including that one about Error: The name of each snapshot must be unique, and this name already exists in the build

CypressError: `cy.then()` timed out after waiting `4000ms`.

Your callback function returned a promise that never resolved.

The callback function was:

dom => {
      let domSnapshot = window.PercyDOM.serialize({ ...options, dom });

      // Post the DOM snapshot to Percy
      return utils.postSnapshot({
        ...options,
        environmentInfo: ENV_INFO,
        clientInfo: CLIENT_INFO,
        domSnapshot,
        url: dom.URL,
        name
      }).then(() => {
        // Log the snapshot name on success
        cylog(name, { name });
      }).catch(error => {
        // Handle errors
        log.error(`Could not take DOM snapshot "${name}"`);
        log.error(error);
      });
    }

https://on.cypress.io/then
    at http://localhost:3000/__cypress/runner/cypress_runner.js:155144:24
    at tryCatcher (http://localhost:3000/__cypress/runner/cypress_runner.js:10325:23)
    at http://localhost:3000/__cypress/runner/cypress_runner.js:5447:41
    at tryCatcher (http://localhost:3000/__cypress/runner/cypress_runner.js:10325:23)
    at Promise._settlePromiseFromHandler (http://localhost:3000/__cypress/runner/cypress_runner.js:8260:31)
    at Promise._settlePromise (http://localhost:3000/__cypress/runner/cypress_runner.js:8317:18)
    at Promise._settlePromise0 (http://localhost:3000/__cypress/runner/cypress_runner.js:8362:10)
    at Promise._settlePromises (http://localhost:3000/__cypress/runner/cypress_runner.js:8438:18)
    at _drainQueueStep (http://localhost:3000/__cypress/runner/cypress_runner.js:5032:12)
    at _drainQueue (http://localhost:3000/__cypress/runner/cypress_runner.js:5025:9)
    at Async.../../node_modules/bluebird/js/release/async.js.Async._drainQueues (http://localhost:3000/__cypress/runner/cypress_runner.js:5041:5)
    at Async.drainQueues (http://localhost:3000/__cypress/runner/cypress_runner.js:4911:14)
From Your Spec Code:
    at Context.eval (http://localhost:3000/__cypress/tests?p=cypress/support/index.js:6312:40)
1reaction
shalem-pravascommented, Jun 26, 2021

On running with --verbose I could see the following extra logs apart from the ones posted above

(node:13894) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of undefined at IncomingMessage.request.on (*/testFilePath/node_modules/@percy/core/dist/server.js:88:69) at processTicksAndRejections (internal/process/next_tick.js:81:5) (node:13894) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:13894) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trying to serve png in Node.js: Cannot read property 'end' of ...
png) it always crashes with the error message TypeError: Cannot read property 'end' of undefined. This happens no matter what image I use...
Read more >
ERROR TypeError: Cannot read property title of undefined
LIKE --- https://codedocu.com/Software/Angular... C# .Net WPF UWP WinUI SQL Server Access Excel vba ++ Freelancer ...
Read more >
Cannot read property search of undefined this props location ...
Attempting to read null or undefined as if it was an object. The length property returns a number for essentially any object in...
Read more >
jest typeerror: cannot read properties of null (reading 'usestate')
I have used ref in it so as to evoke some bottom sheets in the screen. Error message : TypeError: Cannot read properties...
Read more >
Configuring Jest
If the file specified by path is not found, an error is returned. For example, with the following configuration: JavaScript; TypeScript. /** @ ......
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