Skip to content

DeprecationWarning: Implicit coercion to integer for exit code is deprecated #17127

@dionsaur84

Description

@dionsaur84

Bug description

i am running nodemon for an express server that uses prisma

every time nodemon restarts the server, i get this warning:

(node:14591) [DEP0164] DeprecationWarning: Implicit coercion to integer for exit code is deprecated.
    at process.exit (node:internal/process/per_thread:200:7)
    at process.<anonymous> (/Users/dionsaur84/Sites/dio-framework/node_modules/@prisma/client/runtime/index.js:27577:17)
    at Object.onceWrapper (node:events:628:26)
    at process.emit (node:events:513:28)

this warning appears to be triggered by @prisma/client/runtime/index.js:27577:17:

  installHook(event, shouldExit = false) {
    process.once(event, async (code) => {
      debug9(`exit event received: ${event}`);
      for (const listener of this.idToListenerMap.values()) {
        await listener();
      }
      this.idToListenerMap.clear();
      if (shouldExit && process.listenerCount(event) === 0) {
        process.exit(code); // <-- this line
      }
    });
  }

is there a way to surpress this? should i add an event listener for when my server closes to make sure prisma also disconects? how do i resolve this issue myself, or is it a prisma issue?

edit: i've added a $disconnect call to my server close listener and the warning still occurs:

const server = app.listen(env.APP_PORT, () => {
    console.log(`app listening on http://localhost:${env.APP_PORT}`)
})

server.on('close', async () => {
    await prisma.$disconnect()
})

final edit: looks like this is only happening in node 19+ due to this change:

https://fossies.org/diffs/node/v19.2.0_vs_v19.3.0/lib/internal/process/per_thread.js-diff.html

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions