is it possible to spin up a node worker thread within Next 12
Unanswered
Short-tailed Shearwater posted this in #help-forum
Short-tailed ShearwaterOP
Hi, currently looking at implementing Prometheus scraping for an app using NextJS 12.
For reasons out of my control I cannot expose a /metrics endpoint on the nextJS app because it’ll be exposed publicly.
Therefore I am attempting to create a server that works on a node worker thread however struggling to understand where in the lifecycle of a Next JS 12 app I could initialise the worker.
I have attempted a custom express server but it doesn’t seem to like dynamic fallback routes and throws an error.
Upgrading to Next 13 is currently not an option, the project lives within a mono repo and has a bunch of shared dependencies between multiple projects.
For reasons out of my control I cannot expose a /metrics endpoint on the nextJS app because it’ll be exposed publicly.
Therefore I am attempting to create a server that works on a node worker thread however struggling to understand where in the lifecycle of a Next JS 12 app I could initialise the worker.
I have attempted a custom express server but it doesn’t seem to like dynamic fallback routes and throws an error.
Upgrading to Next 13 is currently not an option, the project lives within a mono repo and has a bunch of shared dependencies between multiple projects.