Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Plugin does not work with Node worker threads #13

Open
danielleadams opened this issue Nov 7, 2019 · 4 comments
Open

Plugin does not work with Node worker threads #13

danielleadams opened this issue Nov 7, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@danielleadams
Copy link
Contributor

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)).

@lardcanoe
Copy link

nodejs/node#21783 (comment)

That appears to be the solution, if anyone at Heroku would like to fix this...

@jraoult
Copy link

jraoult commented Oct 26, 2023

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

@jraoult
Copy link

jraoult commented Oct 26, 2023

@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?

@colincasey
Copy link
Contributor

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants