Repository navigation
Closed
Labels
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
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.origin',
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
- deploy https://github.com/spacethree/cloudflare-sveltekit-sentry to cloudflare pages
- visit the deployed site's /sentry-example-page
- click "throw sample error button"
Expected Result
- Sentry object is debug logged on server with real methods and properties
- Sentry logger method is debug logged on server
- "Hello from Sentry! (server method)" should be sent to sentry logging with example structured data attached
Actual Result
- Sentry object only has the 4 properties (see above)
- Sentry logger is null
- access violation attempting to call
logger.info
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Activity
RulaKhaled commentedon Jun 24, 2025
Hello there, thanks for reaching out! I'm not a Cloudflare / SvelteKit expert, but I think the issue stems from a missing logger export in the SvelteKit worker environment that's used when deploying to Cloudflare Pages.
I've added the missing logger export to the worker environment here #16716 , hopefully this should fix the issue. Once this is released, could you test this fix and let me know if it resolves the issue? If the problem persists, we can explore other approaches.
jamemackson commentedon Jun 24, 2025
Thanks @RulaKhaled that would certainly seem to be a part of the problem! In my case I am not seeing any methods on the Sentry object however so I wonder if there's still another issue upstream of the bug you found as well. I'm going to pull this code down and see if I can trace through and find what's going on. Seems like it should be something simple like what you found...
jamemackson commentedon Jun 24, 2025
@RulaKhaled any idea when the next release will be?
RulaKhaled commentedon Jun 25, 2025
The issue might also be related to SvelteKit worker env, i will see what i can find out here.
I am aiming to cut a release today or tomorrow.
jamemackson commentedon Jun 25, 2025
@RulaKhaled I saw the release come out and pulled in the new version and I believe this has fixed the issue. I am now seeing logs flowing in from our Cloudflare pages instances! Thanks so much for the quick fix here!! 🎉