Jakob Norlin @norlin.dev · Nov 16

The docs say this, but I don't quite understand the implications of the difference between "during the life cycle of the request" and "after the response is finished". The whole point of waitUntil is to not block the response, so Vercel's explanation doesn't make sense to me.

1 likes 2 replies

?

Replies

Alvar Lagerlöf · Nov 16

waitUntil: runs callback immediately, doesn't block the rest of the app (no need to await waitUntil itself) after: runs after the response is finished (and thus after server rendering) They both ensure that the env doesn't shut down before the callback promise is resolved.

Fredrik Höglund · Nov 16

Does it make more sense if you think about the case of doing some cleanup after render? Cant do that with waitUntil. Another case is, say you want to gather up a bunch of events and fire them in a single request when you know you have all of them (after render).