Receiving error 1101 Worker threw exception when connecting to pages

Receiving error 1101 Worker threw exception when connecting to pages, how i can solve it?

Hello,

When a Cloudflare Worker encounters an exception (e.g. an error/condition that wasn’t properly handled) it can cause your visitors to see an 1101 Error which will be presented with an HTTP 500 status code. You can find more on Cloudflare Worker error codes and invocation statuses at the links provided.

You can easily handle exceptions in your Worker code by using statements such as try…catch to ensure that if an exception is thrown in your code then it will be caught and handled gracefully.

For example, wrapping code that could trigger an exception as follows:

try 
{
  // potential exception in this code block
  myfunction();
} 
catch (error) 
{
  // if an exception was thrown, catch the error in this block
  console.error(error);
}

Alternatively, if you would rather pass the request onto the origin server in case of an exception, you would add the event.passThroughOnException() function to the Fetch addEventListener as shown below:

addEventListener("fetch", event => {
  event.passThroughOnException()
  event.respondWith(handleRequest(event.request))
})

Please keep in mind that while we are happy to help with troubleshooting the deployment of your Worker script, unfortunately, we cannot debug user code.

For further assistance, we suggest taking a look at our developer documentation or reach out on the community forums where other users and developers can help with your code:

1 Like

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