#Scheduled worker gets an error in production, not locally

3 messages · Page 1 of 1 (latest)

abstract helm
#

I have a scheduled task worker that does a fetch call to an API and then does some work with the results. This is all running fine locally. However, in production, when I make a fetch call to the remote API, I get: “error code: 521”. To be clear, the same fetch() call is run in dev versus production. On a whim, I then built a whole new Worker, HTTP based, copied and pasted the function that makes the fetch() call, and it works fine.

Here's the worker, https://github.com/cfjedimaster/cloudflareworkers-demos/blob/main/scratchworker/src/index.js, and here is (virtually) the same worker as a HTTP service that runs just fine: https://github.com/cfjedimaster/cloudflareworkers-demos/blob/main/getincidents/src/index.js

As I said, if I test locally, it's perfect.

GitHub

Repository for CF Workers demos/examples/etc. Contribute to cfjedimaster/cloudflareworkers-demos development by creating an account on GitHub.

smoky lotus
#

If I hit the URL in your Worker, https://lafayette911.org/WebService1.asmx/getCurrentTrafficConditions, my request just times out.

#

Is it possible that this API you're hitting isn't always available? Or perhaps not available in certain parts of the world, etc.?