Open
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.13.0
Framework Version
React Router 7.5.1, Vite 6.3.0, Wrangler 4.12.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
// worker file: ./workers/app.ts
import { getLoadContext } from "load-context";
import { createRequestHandler } from "react-router";
import * as Sentry from "@sentry/cloudflare"; // <-- this line breaks the Env types
const requestHandler = createRequestHandler(
() => import("virtual:react-router/server-build"),
import.meta.env.MODE
);
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
if (url.pathname.startsWith("/r2")) {
const key = url.pathname.replace(/^\/r2\//, "");
const object = await env.BUCKET.get(key);
if (!object) {
return new Response("Not found", { status: 404 });
}
return new Response(object.body, {
headers: { "Content-Type": "image/jpeg" },
});
}
const loadContext = getLoadContext({
request,
context: { cloudflare: { env, ctx } },
});
return requestHandler(request, loadContext);
},
} satisfies ExportedHandler<Env>;
Steps to Reproduce
- installed
@sentry/cloudflare
v9.13.0 - added the import to
workers/app.ts
import * as Sentry from "@sentry/cloudflare"; // <-- this line breaks the Env types
- my env types break in when i typecheck
- commenting out the import fixes the type errors
// import * as Sentry from "@sentry/cloudflare";
Expected Result
Types should not be corrupted by import Sentry
Actual Result
Broken:
Working (when import is commented out):
Metadata
Metadata
Assignees
Type
Projects
Status
No status