From f999010e153c69a5f2a97e5b6465fac4db298e74 Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Mon, 26 May 2025 13:40:44 -0400 Subject: [PATCH 1/2] feat: include user agent in headers this will be helpful in the future for debugging customer issues since it will tell us what version of the plugins (at least the bundler core) they're using --- packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts | 1 + packages/bundler-plugin-core/src/utils/getPreSignedURL.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts b/packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts index 5acd4a8a..10c8d02a 100644 --- a/packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts +++ b/packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts @@ -693,6 +693,7 @@ describe("Output", () => { headers: new Headers({ Authorization: "token token", "Content-Type": "application/json", + "User-Agent": "codecov-bundler_plugin/1.9.1", }), body: JSON.stringify({ branch: "main", diff --git a/packages/bundler-plugin-core/src/utils/getPreSignedURL.ts b/packages/bundler-plugin-core/src/utils/getPreSignedURL.ts index 4c74228e..3fbea9cd 100644 --- a/packages/bundler-plugin-core/src/utils/getPreSignedURL.ts +++ b/packages/bundler-plugin-core/src/utils/getPreSignedURL.ts @@ -7,6 +7,7 @@ import { type Span, } from "@sentry/core"; import { z } from "zod"; +import { version } from "../../package.json" with { type: "json" }; import { FailedFetchError } from "../errors/FailedFetchError.ts"; import { UploadLimitReachedError } from "../errors/UploadLimitReachedError.ts"; import { type ProviderServiceParams } from "../types.ts"; @@ -53,6 +54,7 @@ export const getPreSignedURL = async ({ }: GetPreSignedURLArgs) => { const headers = new Headers({ "Content-Type": "application/json", + "User-Agent": `codecov-bundler_plugin/${version}`, }); const requestBody: RequestBody = serviceParams; From 58232ef01c8cfff052d9892f4719e7d4925b965a Mon Sep 17 00:00:00 2001 From: joseph-sentry Date: Thu, 19 Jun 2025 11:35:20 -0400 Subject: [PATCH 2/2] fix: correct user agent formatting in headers --- packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts | 2 +- packages/bundler-plugin-core/src/utils/getPreSignedURL.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts b/packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts index 10c8d02a..f0da4281 100644 --- a/packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts +++ b/packages/bundler-plugin-core/src/utils/__tests__/Output.test.ts @@ -693,7 +693,7 @@ describe("Output", () => { headers: new Headers({ Authorization: "token token", "Content-Type": "application/json", - "User-Agent": "codecov-bundler_plugin/1.9.1", + "User-Agent": "codecov-bundler-plugin/1.9.1", }), body: JSON.stringify({ branch: "main", diff --git a/packages/bundler-plugin-core/src/utils/getPreSignedURL.ts b/packages/bundler-plugin-core/src/utils/getPreSignedURL.ts index 3fbea9cd..f461522e 100644 --- a/packages/bundler-plugin-core/src/utils/getPreSignedURL.ts +++ b/packages/bundler-plugin-core/src/utils/getPreSignedURL.ts @@ -54,7 +54,7 @@ export const getPreSignedURL = async ({ }: GetPreSignedURLArgs) => { const headers = new Headers({ "Content-Type": "application/json", - "User-Agent": `codecov-bundler_plugin/${version}`, + "User-Agent": `codecov-bundler-plugin/${version}`, }); const requestBody: RequestBody = serviceParams;