waitUntil is not a function when using workers with modules

I’m trying to use workers with modules and typescript. As a type of context I’m setting ExecutionContext and method waitUntil is visible in IDE. When I try to run on dev or deploy it’s throwing exception

TypeError: context.waitUntil is not a function at line 0, col -2

Where can I find example with typescript and types for context? Why it’s throwing error when "@cloudflare/workers-types": "3.4.0", contains types for this?

Hey,

Could you please share your full code?

1 Like

Sure, there is gist with index.ts, handler.ts, dependencies from package.json and error from running wrangler dev command

Sorry for the delay in getting back to you. It looks like your arguments to the fetch handler are misplaced though - it should be fetch(request, env, ctx) - it looks like you have ctx and env switched.

Yep. now its working. Thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.