Raymond Camden
CDCloudflare Developers
•Created by Raymond Camden on 9/13/2024 in #workers-help
Scheduled worker gets an error in production, not locally
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.
4 replies