is there any way i can do this without creating a worker and push from there?
is there any way i can do this without creating a worker and push from there?
Promise.allSettled more useful there: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled
serviceOne fails and serviceTwo is on-going, report serviceOne's error to Sentry without waiting serviceTwo to be completedIt rejects when any of the input's promises rejects, with this first rejection reason.

Sentry.captureException(error); reports error before the request is completed. AFAIK, Sentry reports errors asynchronously, so when you call Sentry.captureException(error); in the finally and let the worker completed, the error might be buffered by Sentry SDK, but not reported yet if I am not missing anything. So you may need to call await Sentry.flush(); after then.
.send error today: Error: Queue send failed: ConflictConflict Error: Queue send failed: Internal Server Error occasionally on .send, which calling-worker-side retrying does not seem to fix

Network connection lost) - which is troubling since that is now lost payload..send does whatever it needs to do in tough situations to retry under the hood if necessary (like saving to disk when the network is down and retrying later)Promise.allSettledserviceOneserviceOneserviceTwoserviceTwoSentry.captureException(error);Sentry.captureException(error);await Sentry.flush();.send.send.sendError: Queue send failed: ConflictConflictError: Queue send failed: Internal Server ErrorNetwork connection lostasync function waitForAll(promises) {
await Promise.allSettled(
promises
.map(p => p.then(
(x) => x,
(e) => {
Sentry.captureException(e);
throw e;
})
)
);
// Not sure it is needed, it might not be needed
await Sentry.flush();
}
async queue(batch, env, ctx) {
try {
// Schedule sending events asynchronously
const eventsPromises = [
serviceOne.sendEvents(batch),
serviceTwo.sendEvents(batch)
];
// Wait event promises without blocking the response
ctx.waitUntil(waitForAll(eventsPromises));
} catch (error) {
// Errors occurred during event sending are already reported to Sentry by "waitAll" above.
// Here we are just reporting other errors if they are.
Sentry.captureException(error);
}
}