szmarczak / cacheable-lookup

A cacheable dns.lookup(…) that respects TTL :tada:
MIT License
193 stars 29 forks source link

error: Expected an Agent instance as the first argument #84

Open diavrank opened 3 weeks ago

diavrank commented 3 weeks ago

Hi, I am migrating my Nestjs app to use Bun js and I am getting this error:

[8:41:04 PM] Starting compilation in watch mode...

[8:41:30 PM] Found 0 errors. Watching for file changes.

17 | 
18 | const supportsALL = typeof ALL === 'number';
19 | 
20 | const verifyAgent = agent => {
21 |    if (!(agent && typeof agent.createConnection === 'function')) {
22 |            throw new Error('Expected an Agent instance as the first argument');
             ^
error: Expected an Agent instance as the first argument
      at verifyAgent (/Users/diavrank/app/node_modules/cacheable-lookup/source/index.js:22:9)
      at install (/Users/diavrank/app/node_modules/cacheable-lookup/source/index.js:394:3)
      at new Request (/Users/diavrank/app/node_modules/amply.js/lib/request.js:65:19)
      at new Client (/Users/diavrank/app/node_modules/amply.js/lib/client.js:9:20)
      at /Users/diavrank/app/node_modules/amply.js/index.js:4:18
      at /Users/diavrank/app/node_modules/dd-trace/packages/dd-trace/src/ritm.js:97:33
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/dist/commons/services/email.service.js:17:20
      at /Users/diavrank/app/node_modules/dd-trace/packages/dd-trace/src/ritm.js:97:33
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/dist/app/events/events.service.js:105:7
      at /Users/diavrank/app/node_modules/dd-trace/packages/dd-trace/src/ritm.js:97:33
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/dist/commons/services/eraseme.service.js:7:7
      at /Users/diavrank/app/node_modules/dd-trace/packages/dd-trace/src/ritm.js:97:33
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/dist/app/create-event/create-event.service.js:15:7
      at /Users/diavrank/app/node_modules/dd-trace/packages/dd-trace/src/ritm.js:97:33
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/dist/app/companies/connections/services/connections.service.js:53:7
      at /Users/diavrank/app/node_modules/dd-trace/packages/dd-trace/src/ritm.js:97:33
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/dist/app/companies/services/admin-onboarding.service.js:22:7
      at /Users/diavrank/app/node_modules/dd-trace/packages/dd-trace/src/ritm.js:97:33
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39
      at /Users/diavrank/app/node_modules/require-in-the-middle/index.js:188:39

Bun v1.1.34 (macOS arm64)

Command to run Nest app:

bun start

start script in package.json

"start": "bun NODE_ENV=localdev nest start --watch --exec \"bun run\"",

I am using amply.js library that uses this package on its version 6.0.4