fastly / expressly

Express style router for Fastly Compute

Home Page:https://expressly.edgecompute.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature request: access to waitUntil

domdomegg opened this issue · comments

The raw FetchEvent has a method waitUntil that is useful when you wish to send a response back to the client and then perform some additional async work.

Expressly does not currently (AFAIK) expose a way to use this function. It would be helpful for some use cases to expose it or something similar.

A workaround (I think) is to use the private property, but this is very ugly and hacky:

// @ts-expect-error: event is private on request
req.event.waitUntil(promise)

Would properly exposing event be a better solution? That way you have access to everything. For example I am using GEO data provided by Fastly with

req.event.client.geo

Yes, exposing event as part of the public API would work for my use case and could be helpful in others like the geo one.

Thank you for your patience on this! expressly@2.0.0 exposes req.waitUntil and req.geo.