Plugin does not work with Node worker threads
Opened this issue · 4 comments
Referring to the issue that was opened here: heroku/heroku-buildpack-nodejs#727. Opening an issue here to track any conversation and fixes.
Node Metrics as they are currently implemented on Heroku prevents Node worker threads from working. The error will appear as Module did not self-register
.
The current best work around is to disable the Node Metrics. You can do this by running heroku labs:disable nodejs-language-metrics -a APP_NAME
or doing it from the Heroku Dashboard (as pictured in the original issue: heroku/heroku-buildpack-nodejs#727 (comment)).
That appears to be the solution, if anyone at Heroku would like to fix this...
We've been trying to migrate our Heroku-hosted app from ts-node
to tsx
for a year (and gave up multiple times) because of that one. We have not been lucky because somehow the error message wasn't showing up (which would have helped the diagnostic), but we realised that turning Enhanced metrics off was doing the trick. A couple of GitHub searches later, and here I'm 😬.
In our case, it is not just in a worker but from the main program, so we can not run at all. As said earlier, the workaround is easy to apply, but we are missing important metrics.
Here's what we see after running node --import tsx/esm src/index.ts
node:internal/process/esm_loader:40
internalBinding('errors').triggerUncaughtException(
^
Error: Module did not self-register: '/app/.heroku/heroku-nodejs-plugin/heroku-nodejs-plugin.node'.
at Module._extensions..node (node:internal/modules/cjs/loader:1327:18)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130: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 {
code: 'ERR_DLOPEN_FAILED'
}
Node.js v20.9.0
@colincasey, pardon the ping but it seems like you might be the most recent maintainer of this repo. Can we expect a fix for this?
@jraoult I can't promise any timeline for a fix but this is on my radar now. I have a small fix that looks promising for your tsx
issue but I'm not that familiar with the addon code so I'd like to get a deeper understanding of how everything works before committing to it.