Skip to content

TypeError: b.setEntry is not a function SentryPropagator when Supabase URL is in tracePropagationTargets #16230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
felixgabler opened this issue May 7, 2025 · 7 comments

Comments

@felixgabler
Copy link

felixgabler commented May 7, 2025

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nuxt

SDK Version

9.16.1

Framework Version

Nuxt 3.17.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

Our Nuxt 3 application uses @sentry/nuxt (which includes @sentry/opentelemetry, observed with Sentry SDK version ~9.16.1). Server-side Sentry is initialized as follows in sentry.server.config.ts:

// Path: sentry.server.config.ts
import * as Sentry from '@sentry/nuxt';
import supabase from '@supabase/supabase-js';
import dotenv from 'dotenv';

dotenv.config();

Sentry.init({
    enabled: process.env.NODE_ENV === 'production', // Error observed in Vercel (production-like)
    environment: process.env.NODE_ENV,
    dsn: process.env.SENTRY_DSN,
    integrations: [Sentry.supabaseIntegration({ supabaseClient: supabase.SupabaseClient })],
    tracesSampleRate: 1,
    // CRITICAL: Error occurs when process.env.SUPABASE_URL is included here
    tracePropagationTargets: [/^\/(?!\/)/, process.env.SUPABASE_URL!],
    // If process.env.SUPABASE_URL is removed from the array above, the error does NOT occur.
});

The project also includes several @opentelemetry/* packages. The key ones present in the environment where the error occurs are (versions approximate, based on bun pm ls):

  • @opentelemetry/api: ~1.9.0
  • @opentelemetry/core: ~1.30.1
  • @opentelemetry/sdk-trace-base: ~1.30.1
  • @opentelemetry/semantic-conventions: ~1.32.0
  • @opentelemetry/instrumentation-http: ~0.57.2
  • @opentelemetry/instrumentation-undici: ~0.10.1 (also tried with 0.11.0, error persists with both if Supabase URL is a propagation target)
  • @opentelemetry/sdk-node: ~0.57.2
  • @opentelemetry/sdk-logs: ~0.57.2

Note the mix of OpenTelemetry 1.x SDK components (which align with @sentry/opentelemetry peer dependencies) and newer 0.x generation instrumentations/SDK components. The application uses @supabase/supabase-js to interact with a Supabase backend.

Steps to Reproduce

  1. Configure Sentry's tracePropagationTargets to include the application's Supabase URL (process.env.SUPABASE_URL).
  2. Initialize Sentry on the server as shown in the setup, including Sentry.supabaseIntegration.
  3. In a server-side API route or handler, make a call to the Supabase database using the supabase-js client (e.g., a simple await supabaseClient.from('some_table').select('*')).
  4. This setup primarily fails in a Vercel deployment environment.

Expected Result

The Supabase client's HTTP request should be successfully instrumented. If the Supabase URL is a tracePropagationTarget, Sentry trace headers should be injected into the outgoing request to Supabase, and the application should function normally without crashing.

Actual Result

When the supabase-js client makes an HTTP request to the Supabase URL (which uses undici under the hood), and this URL is listed in tracePropagationTargets, the application crashes with the following error:

Uncaught Exception: TypeError: b.setEntry is not a function
at file:///var/task/node_modules/@sentry/opentelemetry/build/esm/index.js:717:20
at Array.reduce (<anonymous>)
at SentryPropagator.inject (file:///var/task/node_modules/@sentry/opentelemetry/build/esm/index.js:715:56)
at PropagationAPI.inject (/var/task/node_modules/@opentelemetry/api/build/src/api/propagation.js:62:44)
at UndiciInstrumentation.onRequestCreated (/var/task/node_modules/@opentelemetry/instrumentation-undici/build/src/undici.js:193:27) // Line number might vary
// ... rest of undici/Node.js internal stack

Workaround:
The error does not occur if:

  1. The Supabase URL (process.env.SUPABASE_URL) is removed from the tracePropagationTargets array in the Sentry initialization.
    OR
  2. Sentry is disabled entirely on the server-side.

This strongly suggests an incompatibility when SentryPropagator attempts to inject trace headers into requests destined for the Supabase URL, specifically in an environment with mixed OpenTelemetry versions (Sentry expecting OTel 1.x context, while instrumentation-undici is from the OTel 0.x line).

@felixgabler felixgabler added the Bug label May 7, 2025
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 7, 2025
@github-actions github-actions bot added the Nuxt label May 7, 2025
@mydea mydea self-assigned this May 8, 2025
@mydea
Copy link
Member

mydea commented May 8, 2025

Hey, thanks for raising this.

0.x and 1.x should be compatible, the 0.x packages are simply "experimental" but also use the 1.x versions of core otel packages, this all seems fine to me 🤔

Some additional questions:

  1. Does the problem also persist if you remove the supabaseIntegration()?
  2. Does the problem happen locally too or only when deploying to vercel, on production?

@mydea
Copy link
Member

mydea commented May 8, 2025

Also to clarify: Are you using a custom OTEL setup in this app, or only OTEL via Sentry.init()? Because we do not use @opentelemetry/sdk-node or @opentelemetry/sdk-logs ourselves, so curious where this would come from 🤔

@felixgabler
Copy link
Author

Thanks for getting back so quickly!

Hey, thanks for raising this.

0.x and 1.x should be compatible, the 0.x packages are simply "experimental" but also use the 1.x versions of core otel packages, this all seems fine to me 🤔

Some additional questions:

  1. Does the problem also persist if you remove the supabaseIntegration()?

It does persist. It always happens when the supabase URL is in the tracePropagationTargets.

  1. Does the problem happen locally too or only when deploying to vercel, on production?

It only happens on Vercel in production

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 8, 2025
@felixgabler
Copy link
Author

Also to clarify: Are you using a custom OTEL setup in this app, or only OTEL via Sentry.init()? Because we do not use @opentelemetry/sdk-node or @opentelemetry/sdk-logs ourselves, so curious where this would come from 🤔

Very curious indeed. We only use the server config as shared above. No custom OTEL setup.

@mydea
Copy link
Member

mydea commented May 9, 2025

OK I see, I would assume it has nothing to do with supabase then, and only with propagation 🤔 the dependencies are very weird though, could you by chance share your package.json dependencies? Then we can try to reproduce this... but this seems vercel specific, haven't seen this one before!

@felixgabler
Copy link
Author

OK I see, I would assume it has nothing to do with supabase then, and only with propagation 🤔 the dependencies are very weird though, could you by chance share your package.json dependencies? Then we can try to reproduce this... but this seems vercel specific, haven't seen this one before!

Absolutely,

{
...

"devDependencies": {
        "@ai-sdk/anthropic": "^1.2.11",
        "@ai-sdk/google": "^1.2.17",
        "@ai-sdk/openai": "^1.3.22",
        "@anthropic-ai/sdk": "^0.41.0",
        "@aws-sdk/client-ses": "^3.804.0",
        "@aws-sdk/client-textract": "^3.804.0",
        "@dargmuesli/nuxt-cookie-control": "^9.0.3",
        "@floating-ui/vue": "^1.1.6",
        "@headlessui/vue": "^1.7.23",
        "@iconify-json/tabler": "^1.2.17",
        "@kyvg/vue3-notification": "^3.4.1",
        "@mastra/core": "^0.9.2",
        "@mastra/pg": "^0.3.2",
        "@mastra/rag": "^0.1.21",
        "@mistralai/mistralai": "^1.6.0",
        "@nuxt/devtools": "latest",
        "@nuxt/eslint": "^1.3.0",
        "@nuxt/fonts": "^0.11.2",
        "@nuxt/icon": "^1.12.0",
        "@nuxt/image": "^1.10.0",
        "@nuxt/scripts": "^0.11.6",
        "@nuxtjs/sitemap": "^7.2.10",
        "@nuxtjs/supabase": "^1.5.0",
        "@raffaelesgarro/vue-use-sound": "^2.0.4",
        "@sentry/nuxt": "^9.16.1",
        "@supabase/supabase-js": "^2.49.1",
        "@sxzz/eslint-config": "^7.0.0",
        "@tailwindcss/typography": "^0.5.16",
        "@tailwindcss/vite": "^4.1.5",
        "@tiptap-pro/extension-file-handler": "^2.18.0-beta.13",
        "@tiptap-pro/extension-unique-id": "^2.18.0-beta.13",
        "@tiptap/core": "^2.12.0",
        "@tiptap/extension-blockquote": "^2.12.0",
        "@tiptap/extension-bold": "^2.12.0",
        "@tiptap/extension-bubble-menu": "^2.12.0",
        "@tiptap/extension-bullet-list": "^2.12.0",
        "@tiptap/extension-code": "^2.12.0",
        "@tiptap/extension-code-block-lowlight": "^2.12.0",
        "@tiptap/extension-color": "^2.12.0",
        "@tiptap/extension-document": "^2.12.0",
        "@tiptap/extension-dropcursor": "^2.12.0",
        "@tiptap/extension-gapcursor": "^2.12.0",
        "@tiptap/extension-hard-break": "^2.12.0",
        "@tiptap/extension-heading": "^2.12.0",
        "@tiptap/extension-highlight": "^2.12.0",
        "@tiptap/extension-history": "^2.12.0",
        "@tiptap/extension-horizontal-rule": "^2.12.0",
        "@tiptap/extension-italic": "^2.12.0",
        "@tiptap/extension-link": "^2.12.0",
        "@tiptap/extension-list-item": "^2.12.0",
        "@tiptap/extension-ordered-list": "^2.12.0",
        "@tiptap/extension-paragraph": "^2.12.0",
        "@tiptap/extension-placeholder": "^2.12.0",
        "@tiptap/extension-strike": "^2.12.0",
        "@tiptap/extension-subscript": "^2.12.0",
        "@tiptap/extension-superscript": "^2.12.0",
        "@tiptap/extension-table": "^2.12.0",
        "@tiptap/extension-table-cell": "^2.12.0",
        "@tiptap/extension-table-header": "^2.12.0",
        "@tiptap/extension-table-row": "^2.12.0",
        "@tiptap/extension-text": "^2.12.0",
        "@tiptap/extension-text-align": "^2.12.0",
        "@tiptap/extension-text-style": "^2.12.0",
        "@tiptap/extension-typography": "^2.12.0",
        "@tiptap/extension-underline": "^2.12.0",
        "@tiptap/pm": "^2.12.0",
        "@tiptap/suggestion": "^2.12.0",
        "@tiptap/vue-3": "^2.12.0",
        "@types/bun": "^1.2.12",
        "@types/common-tags": "^1.8.4",
        "@types/html-minifier": "^4.0.5",
        "@types/katex": "^0.16.7",
        "@types/luxon": "^3.6.2",
        "@types/markdown-it": "^14.1.2",
        "@types/mjml": "^4.7.4",
        "@types/papaparse": "^5.3.16",
        "@unlok-co/nuxt-stripe": "^4.0.2",
        "@vee-validate/yup": "^4.15.0",
        "@vercel/speed-insights": "^1.2.0",
        "@vite-pwa/assets-generator": "^1.0.0",
        "@vite-pwa/nuxt": "^1.0.0",
        "@vueform/multiselect": "^2.6.11",
        "@vueform/slider": "^2.1.10",
        "@vuepic/vue-datepicker": "^11.0.2",
        "@vueuse/nuxt": "^13.1.0",
        "@vueuse/router": "^13.1.0",
        "camelcase-keys": "^9.1.3",
        "chart.js": "^4.4.9",
        "chartjs-adapter-luxon": "^1.3.1",
        "chartjs-plugin-datalabels": "^2.2.0",
        "chroma-js": "^3.1.2",
        "common-tags": "^1.8.2",
        "decamelize-keys": "^2.0.1",
        "elevenlabs": "1.50.5",
        "es-toolkit": "^1.37.2",
        "firebase": "^11.7.0",
        "firebase-admin": "^13.3.0",
        "floating-vue": "^5.2.2",
        "html-minifier": "^4.0.0",
        "jspdf": "^3.0.1",
        "katex": "^0.16.22",
        "langfuse": "^3.37.2",
        "langfuse-vercel": "^3.37.2",
        "linkify-html": "^4.3.0",
        "lowlight": "^3.3.0",
        "luxon": "^3.6.1",
        "markdown-it": "^14.1.0",
        "mime": "^4.0.7",
        "mjml": "^4.15.3",
        "modern-screenshot": "^4.6.0",
        "nuxt": "^3.17.2",
        "nuxt-i18n-micro": "^1.87.0",
        "openai": "^4.97.0",
        "papaparse": "^5.5.2",
        "pdfjs-dist": "^5.2.133",
        "posthog-js": "^1.240.4",
        "posthog-node": "^4.17.1",
        "prettier-plugin-tailwindcss": "^0.6.11",
        "stripe": "^18.1.0",
        "tailwindcss": "^4.1.5",
        "tiptap-extension-auto-joiner": "^0.1.3",
        "ts-fsrs": "^4.7.1",
        "typescript": "^5.8.3",
        "vee-validate": "^4.15.0",
        "vite-svg-loader": "^5.1.0",
        "vue-chartjs": "^5.3.2",
        "vue-component-type-helpers": "^2.2.10",
        "vue-draggable-plus": "^0.6.0",
        "vue-router": "^4.5.1",
        "vue-tsc": "^2.2.10",
        "vue3-lottie": "^3.3.1",
        "vue3-moveable": "^0.28.0",
        "yup": "^1.6.1",
        "zod": "^3.24.4"
    },
    "engines": {
        "node": ">=20.0.0"
    },
    "overrides": {
        "chokidar": "^3.6.0",
        "estree-walker": "2.0.2",
        "sharp": "^0.33.5"
    }
}

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 9, 2025
@andreiborza
Copy link
Member

Hi @felixgabler, thanks for providing that. I will give it a shot at reproducing this.

If you have some time and think you can create a minimal reproduction repo, that'd be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants