Skip to content

DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake. #408

@mwebbmwnz

Description

@mwebbmwnz

Noticing the following warning coming through from the memory/NeDB adaptor a lot after recent updates:

(node:53449) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.

Enabling node --trace-deprecation warning, we get the following trace:

(node:53449) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
    at node:internal/util:476:17
    at new Promise (<anonymous>)
    at Datastore.update (node:internal/util:461:12)
    at MemoryDbAdapter.updateById (/Users/xxx/moleculer-db/packages/moleculer-db/src/memory-adapter.js:222:18)
    at Object.<anonymous> (/Users/xxx/moleculer-db/packages/moleculer-db/test/unit/memory-adapter.spec.js:186:25)
    at Promise.then.completed (/Users/xxx/moleculer-db/node_modules/@jest/core/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/Users/xxx/moleculer-db/node_modules/@jest/core/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/Users/xxx/moleculer-db/node_modules/@jest/core/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)

deprecation ref: https://nodejs.org/api/deprecations.html#dep0174-calling-promisify-on-a-function-that-returns-a-promise

A quick bisect suggests this was introduced with 82f1955

Node 22.20.0
MacOS 15.5

Reproduce

Run the memory adapter unit tests:

NODE_OPTIONS="--trace-deprecation" npm run test:unit packages/moleculer-db/test/unit/memory-adapter.spec.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions