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.

Bluebird / Promise.js warning of deprecated Promise.defer from CircleCi

See original GitHub issue

Issue Description

When running tests in CircleCi, tests failures are no longer uploading to my cypress project dashboard. The end of the cypress test run command step in CircleCi shows the message block shown below. The last recording showing on my dashboard was roughly 24hrs ago and no new test-failure recordings have been uploaded since.

Recorded Run: https://dashboard.cypress.io/#/projects/<I-removed-recording-projectId>/runs/2464                               

(node:987) Warning: a promise was created in a handler at internal/timers.js:443:21 but was not returned from it, see http://goo.gl/rRqMUw
    at Function.Promise.cast (/root/.cache/Cypress/3.5.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:225:13)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 2

Other test warnings are being shown as well, but these are not causing failed upload operation.

(node:987) Warning: Promise.defer is deprecated and will be removed in a future version. Use new Promise instead.

and

tput: No value for $TERM and no -T specified` 

Desired behavior:

After tests run, any failed tests should automatically upload the test recording to my cypress project dashboard.

Steps to reproduce: (app code and test code)

I don’t know what the source of the error is so I don’t know how to reproduce it other than kicking off another build in CircleCi.

This is the contents of my support/index.js code. I have added these in an attempt to debug the error I’m having based on various other reported issues. ( https://github.com/cypress-io/cypress/issues/874 )

support/index.js

// Import commands.js using ES2015 syntax:
import './commands'
// require('cypress-xpath')

Cypress.on('window:before:load', win => {
  win.indexedDB.deleteDatabase('localforage')
})

Cypress.on('uncaught:exception', (err, runnable) => {
  console.log(err, runnable)
  return false
})

Cypress.on('fail', err => {
  debugger
})

// patch Cypress top.onerror
Object.defineProperty(top, 'onerror', {
  value: window.onerror
})

Versions

Cypress: v3.5.0 Chrome: Most updated version available Electron: Most updated version available

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Hooked74commented, Nov 5, 2019

first warning (node: 55218) Warning: Promise.defer is deprecated and will be removed in a future version. Use new Promise instead.) does not appear due to the use of Promise.defer, but because of the use of Promise.pending, which used in video_capture.js:70:23.

// bluebird/js/release/promise.js:758:13
Promise.defer = Promise.pending = function() {
    debug.deprecated("Promise.defer", "new Promise");
    var promise = new Promise(INTERNAL);
    return {
        promise: promise,
        resolve: deferResolve,
        reject: deferReject
    };
};

Stack trace:

    at Object.trace (internal/console/constructor.js:338:11)
    at Function.Promise.defer.Promise.pending (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:758:13)
    at Object.start (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/video_capture.js:70:23)
    at /Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/lib/modes/run.js:632:6
    at tryCatcher (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18)
    at Promise._fulfill (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:673:18)
    at /Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/nodeback.js:42:21
    at /Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16
    at callback (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/graceful-fs/polyfills.js:295:20)
    at FSReqCallback.oncomplete (fs.js:164:5)

(node: 56453) Warning: a promise was created in a handler at internal/timers.js:443:21 but was not returned from it, see http://goo.gl/rRqMUw)

Stack trace:

    at Object.trace (internal/console/constructor.js:338:11)
    at Object.checkForgottenReturns (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/debuggability.js:616:15)
    at Promise._settlePromiseFromHandler (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:558:15)
    at Promise._settlePromise (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/igor/Library/Caches/Cypress/3.6.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:443:21)
0reactions
jennifer-shehanecommented, Mar 3, 2020

Released in 3.6.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deferred migration - Bluebird JS
Deferred migration. Deferreds are deprecated in favor of the promise constructor. If you need deferreds for some reason, you can create them trivially...
Read more >
Deprecated APIs - Bluebird JS
The methods of a PromiseResolver have no effect if the fate of the underlying promise is already decided (follow, reject, fulfill). The use...
Read more >
Warning Explanations - Bluebird.js
Warning : a promise was rejected with a non-error​​ An error is an object that is a instanceof Error . It will at...
Read more >
Error Explanations - Bluebird JS
You got this error because you used new Promise() or new Promise(something) without passing a function as the parameter. If you want to...
Read more >
async-promise-wrapper - npm Package Health Analysis - Snyk
async-promise-wrapper. CircleCI. Async libraries wrapped to use promises. Maps most of the functions in caolan/async to work with functions that ...
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