sexnine
sexnine
Explore posts from servers
CDCloudflare Developers
Created by o0th on 7/19/2023 in #workers-help
waitUntil illigal invocation
for anyone else stumbling upon this issue in the future (like me :3), i had a similar issue using trpc in sveltekit where i was adding the function to the trpc context and it was failing with Illegal invocation: assigning a function that calls waitUntil instead solved this issue for me:
export async function createContext(event: RequestEvent) {
return {
event,
- waitUntil: event.platform.context.waitUntil,
+ waitUntil: (promise: Promise<any>) => {
+ event.platform.context.waitUntil(promise);
+ },
};
}
export async function createContext(event: RequestEvent) {
return {
event,
- waitUntil: event.platform.context.waitUntil,
+ waitUntil: (promise: Promise<any>) => {
+ event.platform.context.waitUntil(promise);
+ },
};
}
3 replies