526 error for my worker

So run all the coding and see what it does?

Read your code, understand it, and fix whatever needs fixing.

In other words, classic debugging.

Hmm… it’s not logging the errors (and you think it would)

In other words, Cloudflare thinks the requests are successfully going through when they are not

There wouldn’t be errors in the first place as you catch them.

You really need to check out your code.

I’ll do that

Those errors indicate script exceptions, time limit being hit, max request count, etc. They do not catch origin errors which this looks like it is. Also as mentioned exceptions are being caught anyway so it wouldn’t count.

So it’s catching exceptions but not logging them?

You aren’t doing any logging in the code. You are however catching the exception in the code.

Anyway, give the entire worker code, it’s hard to find the error with no code.

So I’m on a wild goose chase for the code causing the problem basically?

I mean, 526 indicates SSL error at the origin. You’ve said you don’t believe it’s that. So sharing the code would be helpful.

Sharing the code and origin would allow us to look into the issue.

Well I could check and see if there’s an origin certificate and if not add one

Oh, you want the code!

Sure it’s below

addEventListener(“fetch”, (event) => {
event.respondWith(
handleRequest(event.request).catch(
(err) => new Response(err.stack, { status: 301 })
)
);
});

/**
*

  • @param {Request} request
  • @returns {Promise}
    */
    async function handleRequest(request) {
    const { pathname } = new URL(request.url);

if (pathname.startsWith("/api")) {
return new Response(JSON.stringify({ pathname }), {
headers: { “Content-Type”: “application/json” },
});
}

if (pathname.startsWith("/status")) {
const httpStatusCode = Number(pathname.split("/")[2]);

return Number.isInteger(httpStatusCode)
  ? fetch("https://aboutrock.godaddysites.com" + httpStatusCode)
  : new Response("Oops, you seem to have hit the incorrect link! You will be redirected shortly, if you are not then try reloading the site");

}

return fetch(“https://www.aboutrock.godaddysites.com/redirect-notice”);
}

Yep, your origin doesn’t have a valid SSL certificate hence the 526. The origin needs to have a valid certificate

1 Like

So create a origin certificate?

This is a problem


Screenshot 2021-09-03 9.18.35 AM

I am not quite sure what you are trying with the redirect-notice part, but the www hostname does not have a valid certificate and that is the issue I originally referred to, that the error comes straight from the origin and the script is doing okay as far as execution is concerned.

Unfortunately, development is really beyond the scope of the forum, so you better discuss this at e.g. StackOverflow, but I’d check out the hostnames.

And once more

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