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 access required
Node.js and browser packages are not on public npm yet. Contact us for access before following the installation steps. 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.