Fetching from `api.fiscaldata.treasury.gov` returns 525

No matter what I do, I seem to get a 525 error when trying to fetch data from api.fiscaldata.treasury.gov via a worker Here is a sample url: https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny?sort=-record_date&limit=1 When I run the worker locally everything works fine. Here is my request simple request just to test:
router.get("/api/test", async () => {
const data = await fetch(
"https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny?sort=-record_date&limit=1",
{
headers: {
"Content-Type": "application/json",
},
},
);
const jsonData = await data.json();
return json(jsonData);
});
router.get("/api/test", async () => {
const data = await fetch(
"https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny?sort=-record_date&limit=1",
{
headers: {
"Content-Type": "application/json",
},
},
);
const jsonData = await data.json();
return json(jsonData);
});
I have several other endpoints that are working correctly but here is the response:
{
"status": 500,
"error": "Unexpected token 'e', \"error code: 525\" is not valid JSON"
}
{
"status": 500,
"error": "Unexpected token 'e', \"error code: 525\" is not valid JSON"
}
Things I've tried: 1. Confirmed ssl is set to flexible 2. When it wasn't working on the cloudflare generated domain, I purchased and setup a custom domain via cloudflare 3. Tested hitting the endpoint from the console in a browser 4. I can copy the text from the request to the browser terminal and it works. 5. I attached a screenshot of making the request from the browser window
No description
5 Replies
ShaneCodes
ShaneCodesOP2w ago
@Community Champion Any help on this one? When I go to the worker playground I still seem to be unable to hit this api
andrew_nyr
andrew_nyr2w ago
?pings
Flare
Flare2w ago
Please do not ping community members for non-moderation reasons. Doing so will not solve your issue faster and will make people less likely to want to help you.
Walshy
Walshy2w ago
confirmed ssl is set to flexible
That'd be the one mode you don't want haha Set it to full
ShaneCodes
ShaneCodesOP2w ago
I did set it to full and full strict in efforts to troubleshoot, with the same outcome.
Want results from more Discord servers?
Add your server