waitUntil causes IoContext time out

I'm getting the following warning for ctx.waitUntil
IoContext timed out due to inactivity, waitUntil tasks were cancelled without completing.
This causes my wall time to be 30 seconds long as waitUntil waits until it is timed out. My question is how to get waitUntil to stop waiting. My code can be simplified to this:
// do-this.js
function randomFunction() {
const someVar = 'Hello world!'

return someVar;
}

// server.js
ctx.waitUntil(randomFunction())
// do-this.js
function randomFunction() {
const someVar = 'Hello world!'

return someVar;
}

// server.js
ctx.waitUntil(randomFunction())
I tried to return a string and then a promise but waitUntil still keeps waiting for until it can't anymore. Any ideas on how to solve this? -# Related post (with no answer)??? I use browser rendering and waitUntil as well. https://www.answeroverflow.com/m/1423255822267584523
Getting waitUntil warn in logs, even though I don't have one in the...
Getting this warn log: "IoContext timed out due to inactivity, waitUntil tasks were cancelled without completing." But I don't actually have any waitUntils. The worker uses browser rendering, if that has something to do with it
No description
3 Replies
Ryan
RyanOP2mo ago
Extra non-important info Here are my project specifics, I didn't want to overload my post with extras that aren't needed for a minimal reproduction. I have a Discord app on Cloudflare Workers that just turns Discord messages into images. https://github.com/RyanLua/Disclip The process goes like this: Discord interaction to generate image > interaction handled by server.js which calls a function in clip.js which sends the image to Discord * server.js - Uses ctx.waitUntil to wait for a function in clip.js * clip.js - Creates and sends the image into Discord My issue is waitUntil continues to wait even after the image is sent to Discord. (Whole process is supposed to takes >100ms, not 30,000ms)
GitHub
GitHub - RyanLua/Disclip: Save precious messages and funny moments ...
Save precious messages and funny moments with Disclip. Turn any Discord message into a high-quality image to share across friends and social media. - RyanLua/Disclip
Gab
Gab2mo ago
I don't know what's happening with ctx.waifUntil, but, I can remember that you can limit your worker time execution Refer to: https://developers.cloudflare.com/workers/platform/limits/
Cloudflare Docs
Limits
Cloudflare Workers plan and platform limits.
Ryan
RyanOP2mo ago
I believe it's only for CPU time since you can only be charged for CPU time? I would refer to have my wall time fixed so I can actually use the analytics for seeing how long my worker's request takes to complete

Did you find this page helpful?