diff --git a/functions/api/st.ts b/functions/api/st.ts index a7f978a..f5b5e82 100644 --- a/functions/api/st.ts +++ b/functions/api/st.ts @@ -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, }); }