Sharing data between server and instrumentation
Unanswered
LaPerm posted this in #help-forum
LaPermOP
I have a module that is imported both by my API endpoints and my instrumentation (dynamic import:
However, upon calling an API endpoint, this module is imported freshly again (even though it was registered by the instrumentation) and doesn't seem to use module caching. (Yes, I have an if statement for the
Should I just have my instrumentation call the API endpoint to force the side-effects or is there something I'm doing wrong?
await import()). I declare an object and do some initializing stuff.However, upon calling an API endpoint, this module is imported freshly again (even though it was registered by the instrumentation) and doesn't seem to use module caching. (Yes, I have an if statement for the
NEXT_RUNTIME) and when I log it in the module itself, it's 'nodejs' both times.Should I just have my instrumentation call the API endpoint to force the side-effects or is there something I'm doing wrong?