pinojs / pino

🌲 super fast, all natural json logger
http://getpino.io
MIT License
14.21k stars 875 forks source link

"Module did not self-register" on Heroku #1789

Open dumaron opened 1 year ago

dumaron commented 1 year ago

After installing pino on a private project deploys on Heroku fails. The error message that I've got is:

Error: Module did not self-register: '/app/.heroku/heroku-nodejs-plugin/heroku-nodejs-plugin.node'.
    at Module._extensions..node (node:internal/modules/cjs/loader:1338:18)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Array.__webpack_modules__ (/app/.heroku/heroku-nodejs-plugin/index.js:1079:19)
    at __webpack_require__ (/app/.heroku/heroku-nodejs-plugin/index.js:1106:41)
    at Array.<anonymous> (/app/.heroku/heroku-nodejs-plugin/index.js:19:21)
    at __webpack_require__ (/app/.heroku/heroku-nodejs-plugin/index.js:1106:41)
    at /app/.heroku/heroku-nodejs-plugin/index.js:1127:17
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:290:10)
    at [kOnMessage] (node:internal/worker:301:37)
    at MessagePort.<anonymous> (node:internal/worker:202:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28) {
  code: 'ERR_DLOPEN_FAILED'

It seems that this issue is somewhat common in NodeJS land (1 2) but there are no solution so far that doesn't involve changing external libraries. I tried to identify what part/library of pino was causing this issue, but with no luck so far.

While I will definitely discuss this issue with Heroku support, does anyone know if there's a way to runpino in the main thread, which should be de thing the issue comes from? Maybe there are transports that do that?

mcollina commented 1 year ago

most transports have some kind of API to instatiate them as streams.

dumaron commented 1 year ago

So far I've tried both pino-pretty and pino-datadog-transport but both seem to be streams, and the issue is still there. I'll continue investigating 👍