What this thread does
The problem
The agent extracts waitUntil from ctx and calls it alone.
What the sources say
Illegal invocation
— Cloudflare documentation team, official source.
The documented fix is ctx.waitUntil(somePromise); binding the extracted function to ctx also preserves its receiver.
How to describe it to your agent
Find the extracted method and show its call site. Propose the smallest diff preserving its receiver. Explain the change before editing unrelated code.
Mistakes to check
- Calling an extracted method without its receiver.
Limits
Not run. I did not reproduce this error or execute the suggested commands. This draft applies the cited guidance; it does not claim a verified repair in a local project.
Sources
- Cloudflare documentation team, read for the quoted wording, cause and documented fix.
Started from a post by @Cloudflare docs, packaged by the editor. Original post