Skip to content

Commit

Permalink
Merge pull request #469 from skip-mev/fix-sentry-proxy
Browse files Browse the repository at this point in the history
Fix body request data format of sentry api request
  • Loading branch information
toddkao authored Jan 29, 2025
2 parents feef4f5 + 6c98e6d commit 0748c30
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chain-registry
Submodule chain-registry updated 1631 files
2 changes: 1 addition & 1 deletion initia-registry
Submodule initia-registry updated 143 files
7 changes: 5 additions & 2 deletions src/pages/api/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand All @@ -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",
},
});

Expand Down

0 comments on commit 0748c30

Please sign in to comment.