H
Hono7mo ago
tony

executionCtx.waitUntil on write service

I have a worker that I want to call an external api on, but I want to return a response without awaiting the the external api call. (the external api call is to just save time writing to the db on another service).
const promise = fetch('http://localhost:3000/impression', {
method: "POST",
body: JSON.stringify(data),
headers: {
"content-type": "application/json",
}
});
c.executionCtx.waitUntil(promise.then())

flow.params = { campaignId: campaignId }
return flow;
const promise = fetch('http://localhost:3000/impression', {
method: "POST",
body: JSON.stringify(data),
headers: {
"content-type": "application/json",
}
});
c.executionCtx.waitUntil(promise.then())

flow.params = { campaignId: campaignId }
return flow;
however when I am testing it local and it is not hitting the service I am using hono https://hono.dev/api/context#executionctx the worker is on localhost:8787 and the write service for the impression is on localhost:3000 I am able to create the impression successfully calling it directly but the waitUntil is not hitting localhost:3000 when calling the localhost:8787 endpoint
Context - Hono
Ultrafast web framework for Cloudflare Workers, Fastly Compute, Deno, Bun, Vercel, Node.js, and others. Fast, but not only fast.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server