Content-Length: 309244 | pFad | http://github.com/getsentry/sentry-javascript/issues/16711

6E logger is null when deployed in sveltekit app to Cloudflare pages · Issue #16711 · getsentry/sentry-javascript · GitHub
Skip to content

logger is null when deployed in sveltekit app to Cloudflare pages #16711

Closed
@jamemackson

Description

@jamemackson

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/cloudflare

SDK Version

9.31.0

Framework Version

SvelteKit 2.16.0 - Svelte ^5.25.0 - Vite ^6.2.6

Link to Sentry event

No response

Reproduction Example/SDK Setup

Everything works fine locally sending errors and logs to Sentry, but when deployed to cloudflare pages (v3 runtime with node compat flag) the Sentry objected imported seems uninitialized with only the following 4 constants set, but no methods or other properties that are visible from the same console.log messages when I'm working locally.

import * as Sentry from "@sentry/sveltekit";
const { logger } = Sentry;

export const GET = async () => {
  console.log("Sentry =>", Sentry);
  console.log("Sentry logger =>", logger);
  logger.info("Hello from Sentry! (server method)", {
    requestId: "123",
  });
  throw new Error("Sentry Example API Route Error");
};
(log) Sentry => {
  SDK_VERSION: '9.31.0',
  SEMANTIC_ATTRIBUTE_SENTRY_OP: 'sentry.op',
  SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'sentry.origen',
  SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE: 'sentry.sample_rate',
  SEMANTIC_ATTRIBUTE_SENTRY_SOURCE: 'sentry.source'
}
(log) Sentry logger => null

has anyone else encountered this??

I've got an isolated example that exhibits the same behavior i encountered when implementing this in my real project here: https://github.com/spacethree/cloudflare-sveltekit-sentry

Steps to Reproduce

  1. deploy https://github.com/spacethree/cloudflare-sveltekit-sentry to cloudflare pages
  2. visit the deployed site's /sentry-example-page
  3. click "throw sample error button"

Expected Result

  1. Sentry object is debug logged on server with real methods and properties
  2. Sentry logger method is debug logged on server
  3. "Hello from Sentry! (server method)" should be sent to sentry logging with example structured data attached

Actual Result

  1. Sentry object only has the 4 properties (see above)
  2. Sentry logger is null
  3. access violation attempting to call logger.info

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: http://github.com/getsentry/sentry-javascript/issues/16711

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy