NextJS revalidateTag won't work if it's not called in an awaited promise
Using unstable_cache extensions or "use cache" if you’re on NextJS16, you can leverage revalidateTag to invalidate cache across cached calls. However, I noticed today that these won’t work in a route handler that is not async. And I’m not yet sure why. This was my original (simplified) route handler: export async function POST(req: Request) { try { void someTask(); return NextResponse.json({ done: true }); } catch (err) { return new NextResponse(`Internal error`, { status: 500, }); } } Note that someTask returns a Promise which I didn’t await initially: the caller only needed to know that someTask was called, not that it succeeded. However, it became evident someTask didn’t behave properly. ...