Next.js Discord

Discord Forum

[14.2.16] - switching azure-pipeline to latest-ubuntu cause problem when building

Unanswered
Florida White posted this in #help-forum
Open in Discord
Florida WhiteOP
Hey guys, we tried to speed-up a little bit our pipelines and after switching to ubuntu we got less time which is great. But also after upgrading next.js from 14.1.4 to 14.2.16 (14.2.15 also fails) it cause some problems when building or working.

 TypeError [ERR_INVALID_ARG_VALUE]: An error occurred while loading instrumentation hook: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///home/vsts/work/1/s/client/cms/node_modules/@vercel/otel/dist/node/index.js'


instrumentation file where I'm importing vercel otel
import { AzureMonitorTraceExporter, ApplicationInsightsSampler } from "@azure/monitor-opentelemetry-exporter";
import { registerOTel } from "@vercel/otel";

export async function register() {
  if (process.env.NEXT_RUNTIME === "nodejs" && process.env.APPLICATIONINSIGHTS_CONNECTION_STRING) {
    const samplingRation = Number(process.env.APPLICATIONINSIGHTS_SAMPLING_RATIO) || 0.1;
    registerOTel({
      traceSampler: new ApplicationInsightsSampler(samplingRation), // TODO: use environment variable
      serviceName: "name",
      traceExporter: new AzureMonitorTraceExporter({
        connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING
      }),
      instrumentationConfig: {
        fetch: {
          propagateContextUrls: ['my-domain']
        }
      }
    });
  }
}

0 Replies