Next.js Discord

Discord Forum

Adding `instrumentationHook: true` is causing external API requests to return 400.

Unanswered
Kurilian Bobtail posted this in #help-forum
Open in Discord
Kurilian BobtailOP
Hi NextJS Team,

I added this variable to my config file to start tracing all my LLM calls and it starts causing an api request to llama parse to start returning a 400 error.

The request:
try {
    response = await fetch(`${LLAMAPARSE_API_BASE_URL}/api/v1/parsing/upload`, {
      method: "POST",
      body: formData,
      headers: {
        Accept: "application/json",
        Authorization: `Bearer ${process.env.LLAMA_INDEX_API_KEY}`
      }
    })
  } catch (error: any) {}

instrumentation.ts
import { registerOTel } from "@vercel/otel"
import { LangfuseExporter } from "langfuse-vercel"

export function register () {
  registerOTel({
    serviceName: "langfuse-vercel-ai-outlit",
    traceExporter: new LangfuseExporter()
  })
}


Versions
next: 14.2.5

I'm curious as to what headers/body params get added to external API calls that could be causing the error? Commenting out instrumentationHook: true fixes the issue.

0 Replies