Skip to content

Commit aaf0d40

Browse files
committed
pass through sentry client in getPreSignedURL and uploadStats
1 parent 2d19385 commit aaf0d40

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,17 +6,20 @@ 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
preSignedUrl: string;
1314
retryCount?: number;
15+
sentryClient?: SentryClient;
1416
}
1517

1618
export async function uploadStats({
1719
message,
1820
preSignedUrl,
1921
retryCount = DEFAULT_RETRY_COUNT,
22+
sentryClient,
2023
}: UploadStatsArgs) {
2124
const iterator = message[Symbol.iterator]();
2225
const stream = new ReadableStream({
@@ -36,7 +39,8 @@ export async function uploadStats({
3639
response = await fetchWithRetry({
3740
url: preSignedUrl,
3841
retryCount,
39-
name: "`upload-stats`",
42+
name: "upload-stats",
43+
sentryClient,
4044
requestData: {
4145
method: "PUT",
4246
headers: {

0 commit comments

Comments
 (0)