Recommand · October 22, 2021 0

SvelteKit externalFetch function in hooks never gets called

I am trying to modify my fetch request for external API to include a custom header. After trying multiple things, I saw externalFetch in the documentation which seems to serve the purpose of modifying the request but the problem is it never gets called. What am I missing?

export async function externalFetch(request) {
    request.headers['authorization'] = 'HMAC 12.33';
    console.log('hook headers', request);
    request = new Request(

    return fetch(request);