All recipes
SvelteKit
CodeServer hooksSvelte
Create the handle hook in hooks.server.ts. It initializes the SDK when the hook is created and measures supported outbound fetch calls. Where the platform exposes waitUntil, it uses that context to flush after a response.
SDK availability
@checkupstream/sdk 0.1.0 is on npm and records requests made with fetch. The browser package is not published; contact us for access. Check the SDK reference for your runtime and review what the SDK sends.1. Install
Bash
npm install @checkupstream/sdk2. Wire into hooks.server.ts
src/hooks.server.ts
import { checkUpstreamHandle } from "@checkupstream/sdk/integrations/sveltekit";
import { env } from "$env/dynamic/private";
const sdkKey = env.CHECKUPSTREAM_SDK_KEY;
if (!sdkKey) throw new Error("Set CHECKUPSTREAM_SDK_KEY before starting the app");
export const handle = checkUpstreamHandle({
sdkKey,
});Tip
If you already have a handle chain, compose checkUpstreamHandle() into it with the sequence() helper from @sveltejs/kit/hooks.
Related
Continue your setup
Check runtime availability and credentials before deploying an integration.