Is this a Worker/Wrangler/Hyperdrive bug? Request succeeds but then errors on refresh

I have a weird situation whereby an endpoint hosted on CF Workers successfully returns a response. But if I hit refresh soon after (within a couple of seconds) I then get a CF error:
A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.
✘ [ERROR] Uncaught (in response) Error: The script will never generate a response.

The error makes no sense to me because if the promise could not "possible ever resolve", then it wouldn't have given me a 200 status with output the first time. The problem is only on refresh.

This happens only with endpoints that talk to Hyperdrive. A simple endpoint that outputs a static response does not exhibit this problem, not matter how many times, or how quick, I hit refresh.

I'm using Itty Router, and I cannot see anything in my code that would point to a hanging promise or anything like that - I'm using Itty as advertised.

Thank you.
Was this page helpful?