From 6c98e6dd945750a18ca8494afc423888c98b0c24 Mon Sep 17 00:00:00 2001 From: Todd Kao Date: Wed, 29 Jan 2025 12:46:32 -0500 Subject: [PATCH] Fix body of sentry api request --- chain-registry | 2 +- initia-registry | 2 +- src/pages/api/sentry.ts | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/chain-registry b/chain-registry index 58e9a493..8304df24 160000 --- a/chain-registry +++ b/chain-registry @@ -1 +1 @@ -Subproject commit 58e9a493575802d398b33582a5ce66320fb06da4 +Subproject commit 8304df2430e1d3418bb2102ac76af5a138141216 diff --git a/initia-registry b/initia-registry index 4f363dfa..6e92fa04 160000 --- a/initia-registry +++ b/initia-registry @@ -1 +1 @@ -Subproject commit 4f363dfaa947cdf291c050545f8a4110989c04e8 +Subproject commit 6e92fa045812cc8068b7d172490e900160f0bf31 diff --git a/src/pages/api/sentry.ts b/src/pages/api/sentry.ts index 611c77a0..ed807637 100644 --- a/src/pages/api/sentry.ts +++ b/src/pages/api/sentry.ts @@ -10,6 +10,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) try { const requestBody = req.body; + const encoder = new TextEncoder(); + const envelopeBytes = encoder.encode(requestBody); const [headerPiece] = requestBody.split("\n"); const header = JSON.parse(headerPiece); const dsn = new URL(header["dsn"]); @@ -24,11 +26,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) } const upstream_sentry_url = `https://${SENTRY_HOST}/api/${project_id}/envelope/`; + await fetch(upstream_sentry_url, { method: "POST", - body: requestBody, + body: envelopeBytes, headers: { - "Content-Type": req.headers["content-type"] || "application/octet-stream", + "Content-Type": "application/octet-stream", }, });