Skip to content

Commit f69b3c7

Browse files
committed
adjust sveltekit
1 parent 437fb0c commit f69b3c7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/sveltekit/src/worker/cloudflare.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
wrapRequestHandler,
66
} from '@sentry/cloudflare';
77
import { addNonEnumerableProperty } from '@sentry/core';
8-
import type { Handle } from '@sveltejs/kit';
8+
import type { Handle, MaybePromise } from '@sveltejs/kit';
99
import { rewriteFramesIntegration } from '../server-common/rewriteFramesIntegration';
1010

1111
/**
@@ -34,12 +34,16 @@ export function initCloudflareSentryHandle(options: CloudflareOptions): Handle {
3434
return wrapRequestHandler(
3535
{
3636
options: opts,
37+
// @ts-expect-error This expects a cloudflare request, but we cannot type
38+
// it in the sveltekit worker.
3739
request: event.request,
3840
// @ts-expect-error This will exist in Cloudflare
3941
context: event.platform.context,
4042
},
4143
() => resolve(event),
42-
);
44+
// We need to cast this because `wrapRequestHandler` returns a Cloudflare Response,
45+
// which is not compatible with the regular Response type.
46+
) as unknown as MaybePromise<Response>;
4347
}
4448
return resolve(event);
4549
};

0 commit comments

Comments
 (0)