diff --git a/documentation/docs/30-advanced/20-hooks.md b/documentation/docs/30-advanced/20-hooks.md index 9f36559b6c18..9a6230d00784 100644 --- a/documentation/docs/30-advanced/20-hooks.md +++ b/documentation/docs/30-advanced/20-hooks.md @@ -99,7 +99,7 @@ For example, your `load` function might make a request to a public URL like `htt ```js /// file: src/hooks.server.js /** @type {import('@sveltejs/kit').HandleFetch} */ -export function handleFetch({ request, fetch }) { +export async function handleFetch({ request, fetch }) { if (request.url.startsWith('https://api.yourapp.com/')) { // clone the original request, but change the URL request = new Request( @@ -124,7 +124,7 @@ If your app and your API are on sibling subdomains — `www.my-domain.com` and ` /// file: src/hooks.server.js // @errors: 2345 /** @type {import('@sveltejs/kit').HandleFetch} */ -export function handleFetch({ event, request, fetch }) { +export async function handleFetch({ event, request, fetch }) { if (request.url.startsWith('https://api.my-domain.com/')) { request.headers.set('cookie', event.request.headers.get('cookie')); } @@ -177,7 +177,7 @@ import crypto from 'crypto'; Sentry.init({/*...*/}) /** @type {import('@sveltejs/kit').HandleServerError} */ -export function handleError({ error, event }) { +export async function handleError({ error, event }) { const errorId = crypto.randomUUID(); // example integration with https://sentry.io/ Sentry.captureException(error, { event, errorId }); @@ -205,7 +205,7 @@ import * as Sentry from '@sentry/svelte'; Sentry.init({/*...*/}) /** @type {import('@sveltejs/kit').HandleClientError} */ -export function handleError({ error, event }) { +export async function handleError({ error, event }) { const errorId = crypto.randomUUID(); // example integration with https://sentry.io/ Sentry.captureException(error, { event, errorId });