Cloudflare API return HTTP-500 inside worker/pages

Hi, calling the Cloudflare API inside a page functions, always returns 500.
I tried many endpoints, with and without auth (just to see if the 401 returned).
I think there’s some internal block or routing issue.

Of course, calling from outside, everything works. Even calling from wrangler in dev, that is from my machine.
From inside, nothing works, even a simple GET, always 500 with no error detail.
If I relay the call to an outside server, it works. So the issue is a direct calls from inside the pages functions.

export const onRequest = async () => {
    return await fetch(`https://api.cloudflare.com/client/v4/user`, {
        method: "GET",
         headers: {
             authorization: `Bearer xxxxxxxxx`,
         },
    });
}

There’s a known issue right now with various APIs throwing 500s. It’s being investigated and a fix should be out soon. Sorry for any inconvenience!

Hi there,

Apologies for this inconvenience caused by this issue and thank you for reporting. It should be resolved now.

We added a note to the following statuspage:

Cloudflare API in Pages Functions may also have been affected returning intermittent 500 errors.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.