I’m trying to set up tracing for our Netlify site which is using NextJS. If I were deploying the site in a docker container I would just make sure that the tracing module was the first import in the application since it hooks into the node runtime to do auto instrumentation. It’s also possible to use the
--require flag for node to require the tracing setup before the application is started.
An example of the setup can be seen here: Instrumenting with OpenTelemetry | Honeycomb
I’m having a hard time figuring out a way to make tracing work in Netlify.
I’ve tried various approaches but none of them work. E.g. i’ve tried requiring the tracer module at the top of the functions and I’ve also tried adding
NODE_OPTIONS=--require tracer.js(which is supported in AWS Lambda) but the build fails because unfortunately all Netlify environment variables are also loaded during build instead of only at runtime and therefore the
yarn install command fails because it is run with
I’m not sure if there are any other ways to get this working and was hoping that I could get some fresh ideas.