Skip to content

Commit 62cab8f

Browse files
committed
pass through sentry client in getPreSignedURL and uploadStats
1 parent 7ce2799 commit 62cab8f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/bundler-plugin-core/src/utils/getPreSignedURL.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import { DEFAULT_RETRY_COUNT } from "./constants.ts";
88
import { fetchWithRetry } from "./fetchWithRetry.ts";
99
import { green, red } from "./logging.ts";
1010
import { preProcessBody } from "./preProcessBody.ts";
11+
import { type SentryClient } from "../sentry.ts";
1112

1213
interface GetPreSignedURLArgs {
1314
apiURL: string;
1415
uploadToken?: string;
1516
serviceParams: Partial<ProviderServiceParams>;
1617
retryCount?: number;
18+
sentryClient?: SentryClient;
1719
}
1820

1921
const PreSignedURLSchema = z.object({
@@ -25,6 +27,7 @@ export const getPreSignedURL = async ({
2527
uploadToken,
2628
serviceParams,
2729
retryCount = DEFAULT_RETRY_COUNT,
30+
sentryClient,
2831
}: GetPreSignedURLArgs) => {
2932
if (!uploadToken) {
3033
red("No upload token found");
@@ -38,7 +41,8 @@ export const getPreSignedURL = async ({
3841
response = await fetchWithRetry({
3942
url,
4043
retryCount,
41-
name: "`get-pre-signed-url`",
44+
sentryClient,
45+
name: "get-pre-signed-url",
4246
requestData: {
4347
method: "POST",
4448
headers: {

packages/bundler-plugin-core/src/utils/uploadStats.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@ import { fetchWithRetry } from "./fetchWithRetry";
66
import { DEFAULT_RETRY_COUNT } from "./constants";
77
import { UploadLimitReachedError } from "../errors/UploadLimitReachedError";
88
import { FailedFetchError } from "../errors/FailedFetchError";
9+
import { type SentryClient } from "../sentry.ts";
910

1011
interface UploadStatsArgs {
1112
message: string;
1213
bundleName: string;
1314
preSignedUrl: string;
1415
retryCount?: number;
16+
sentryClient?: SentryClient;
1517
}
1618

1719
export async function uploadStats({
1820
message,
1921
bundleName,
2022
preSignedUrl,
2123
retryCount = DEFAULT_RETRY_COUNT,
24+
sentryClient,
2225
}: UploadStatsArgs) {
2326
const iterator = message[Symbol.iterator]();
2427
const stream = new ReadableStream({
@@ -38,7 +41,8 @@ export async function uploadStats({
3841
response = await fetchWithRetry({
3942
url: preSignedUrl,
4043
retryCount,
41-
name: "`upload-stats`",
44+
name: "upload-stats",
45+
sentryClient,
4246
requestData: {
4347
method: "PUT",
4448
headers: {

0 commit comments

Comments
 (0)