#Randomly worker requests are being canceled

17 messages ยท Page 1 of 1 (latest)

glossy junco
#

Hi ๐Ÿ‘‹ ! We have a Cloudflare worker (with two environments) that accepts PATCH requests and makes update requests to Baserow. I suddenly noticed yesterday the worker is canceling the requests without throwing any kind of errors. Everything works fine tills a fetch request is made. Sometimes the code works, so I'm confused if the worker is hitting any time limit.

Note:

  1. Changing the custom domain URL and changing it back somewhat fixes the issue. Sometimes the requests get canceled but the fetch request goes through. Sometimes the fetch request goes through without canceling the request.
  2. Setting workers_dev to true somewhat fixes the issue too. Sometimes the requests get canceled but the fetch request goes through. If I set it to false again, sometimes it keeps working, sometimes it doesn't.

Code: https://github.com/dilmaheu/dilmahtea.me-workers/blob/main/src/workers/dilmahtea-me-baserow/src/index.ts

GitHub

Contribute to dilmaheu/dilmahtea.me-workers development by creating an account on GitHub.

honest shale
#

The workaround is to read the body but to do nothing with it.

// Read the body but discard it.
await response.text()
glossy junco
#

Interesting! Let me notify you after trying it

glossy junco
#

@honest shale I tried it but reading the body doesn't fix the issue

smoky garden
#

You maybe hit the cpu time limits. You can see that on the cloudflare dashboard; Workers > your worker > Metrics tab > Error tab at the bottom. There is a legend Exceeded CPU Limits shows this kind of errors.

#

Also you can try changing your workers usage model to Unbound from Bundled if it is Bundled

glossy junco
#

The worker is already on the Unbound usage model. And no we are not hitting any CPU limits

#

The metrics tab shows 100% success rate. It seems canceled requests do not count as errors.

glossy junco
#

@honest shale though your solution didn't solve this issue, could you please explain why not consuming the response body can cause the worker to be canceled??

honest shale
#

Unsure, might be fixed now. We used to see that happen sometimes, anyway.

glossy junco
#

Interesting ๐Ÿค”

#

@honest shale since the requests are sometimes getting canceled even before making the fetch request, what do you think the issue can be??

honest shale
#

I'm unsure, sorry. Sometimes a request can be cancelled if a person actually cancels the request (navigates away, hits Control + C with cURL, closes the tab or browser) so that might be it?

austere pier
#

Hi, Does changing a worker's Usage model in cloudflare worker dashboard incur downtime or is it only applied to new instances of that worker?