petkaantonov / bluebird

:bird: :zap: Bluebird is a full featured promise library with unmatched performance.

Home Page:http://bluebirdjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documented installation method doesn't work with Node 18

hbielenia opened this issue · comments

Node version: 18.14.0
Bluebird version: 3.7.2

Hello, I would like to use Bluebird instead of native Promises because native stack traces give me no clue where to look for errors that are happening. I tried installation method described right there on getting started page:

import * as Promise from 'bluebird';

This works fine. Unfortunately, trying to call Promise.config() results in an error:

TypeError: Promise.config is not a function

This seems to indicate that the native Promise doesn't get overwritten. However, googling doesn't turn many results on that, which probably means that this isn't a widely encountered problem but only something wrong with my setup.

I'm enclosing an example source code file. Executing it with node bluebirdtest.js give me the aforementioned error.

bluebirdtest.tar.gz

Hello, I would like to use Bluebird instead of native Promises because native stack traces give me no clue where to look for errors that are happening

We fixed native stack traces in Node.js with async functions and native promises a while ago (circa 2018) - can you outline what doesn't work?


This seems to indicate that the native Promise doesn't get overwritten

I can't extract the tar.gz file here (on mobile) can you upload a gist or a gh repo?

We fixed native stack traces in Node.js with async functions and native promises a while ago (circa 2018) - can you outline what doesn't work?

I added Promises around Node's http callback-based utility functions and I'm getting an error like this one:

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED ::1:80
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
Emitted 'error' event on ClientRequest instance at:
    at Socket.socketErrorListener (node:_http_client:502:9)
    at Socket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 80
}

Node.js v18.14.0

The error itself is pretty straightforward, but stack trace doesn't show where in my code does this call originate. After Googling, I learned that Bluebird is supposedly capable of longer stack traces and I want to check if it would do the job here.

I can't extract the tar.gz file here (on mobile) can you upload a gist or a gh repo?

Sure thing: https://gist.github.com/hbielenia/6dc79ded33f461dcf971002cd077b554