Send back response from sentry through tunnel
All checks were successful
Test, Build, Deploy / Test, Build, and Deploy (push) Successful in 54s
Test, Build, Deploy / Create Sentry Release (push) Successful in 7s

This commit is contained in:
2026-03-14 01:47:42 -04:00
parent 7352d0bb43
commit 8e34e2ce24

View File

@@ -12,18 +12,24 @@ export async function onRequestPost(context: RequestContext) {
const sentryUrl = new URL(dsn);
await fetch(`https://${sentryUrl.host}/api${sentryUrl.pathname}/envelope`, {
body: clonedRequest.body,
headers: {
"content-type": "application/x-sentry-envelope",
"x-forwarded-for": context.request.headers.get(
"cf-connecting-ip",
) as string,
const resp = await fetch(
`https://${sentryUrl.host}/api${sentryUrl.pathname}/envelope`,
{
body: clonedRequest.body,
headers: {
"content-type": "application/x-sentry-envelope",
"x-forwarded-for": context.request.headers.get(
"cf-connecting-ip",
) as string,
},
method: "POST",
},
method: "POST",
});
);
return new Response(null, {
status: 204,
return new Response(await resp.text(), {
headers: {
"content-type": resp.headers.get("content-type") || "text/plain",
},
status: resp.status,
});
}