All Cloudflare Snippets are throwing errors

Error 1101 Worker threw exception there's nothing on the cf status page informing about this issue. and no one discusses it here, so I need info about why is this happening to all our snippets. edit 1: snippets that were previously working and we didn't even update encounter the same error too. so I assume it's not something wrong with the code. edit 2: using gtmetrix to see if it's reachable from other region, but no it's not. got 500 Internal Server Error
20 Replies
arasseo.
arasseo.OP4w ago
still got errors and it's been 7+ hours since and no mentions or anything on cf status page related to this issue.
Error 1101 Ray ID: 92299618288c5724 • 2025-03-19 02:37:09 UTC
Worker threw exception
Error 1101 Ray ID: 92299618288c5724 • 2025-03-19 02:37:09 UTC
Worker threw exception
creating a new snippet using one of the available templates doesn't work too.
Error 1101 Ray ID: 9229b9f8ac7412b0 • 2025-03-19 03:01:39 UTC
Worker threw exception
Error 1101 Ray ID: 9229b9f8ac7412b0 • 2025-03-19 03:01:39 UTC
Worker threw exception
What to expect: This code is using one of the templates (Maintenance Page), modified the html a bit. We expected it to just work, but it's not, and giving errors such as the above Ray IDs. When tested inside the web editor Preview, it works, but it's throwing errors when deployed. Snippet Rule: All incoming requests Code to reproduce:
// Define your customizable inputs
const statusCode = 200;
const title = "We'll Be Right Back!";
const message = "Our site is currently undergoing scheduled maintenance. We’re working hard to bring you a better experience. Thank you for your patience and understanding.";
const estimatedTime = "3 to 7 work days";

export default {
async fetch(request) {
// Serve the maintenance page as a response
return new Response(generateMaintenancePage(), { status: statusCode,
headers: { "Content-Type": "text/html", "Retry-After": "3600", // Suggest retry after 1 hour
},
});
},
};

function generateMaintenancePage() {
return `
// html code here
`;
}
// Define your customizable inputs
const statusCode = 200;
const title = "We'll Be Right Back!";
const message = "Our site is currently undergoing scheduled maintenance. We’re working hard to bring you a better experience. Thank you for your patience and understanding.";
const estimatedTime = "3 to 7 work days";

export default {
async fetch(request) {
// Serve the maintenance page as a response
return new Response(generateMaintenancePage(), { status: statusCode,
headers: { "Content-Type": "text/html", "Retry-After": "3600", // Suggest retry after 1 hour
},
});
},
};

function generateMaintenancePage() {
return `
// html code here
`;
}
ncano
ncano4w ago
there was nothing wrong with Snippets backend or control plane for weeks, so the issue is specific to your code or account configuration. your code works if contact references are removed from the template.
arasseo.
arasseo.OP3w ago
even using default template will throw Error 1101. this happened as per march 18th 2025, there's a snippet that's last edited 15 Feb, 2025 06:28:40 and was working perfectly before the sudden exception errors. new snippets created will throw the same error. it's not error from code, but there's just so little information shown from the user's perspective, nothing helps at all. I provided some Ray IDs above, not sure if that'll even help debug anything from cf's side. did open a ticket since 3/19/2025, 02:26 AM GMT+7, not sure how long it'll take to get some real support there. to add more context, the code works fine if you Preview it with the web code editor, but once deployed, it'll just throwing exceptions. the problem is that even deploying unedited Snippets' code examples doesn't work nor editing it will make the errors go away.
ncano
ncano3w ago
do you have any other snippet or worker triggering on the same request by any chance? anything weird in Trace output (https://developers.cloudflare.com/fundamentals/trace-request/) ? i can't look up your rayIDs, but i can take a look if you ping me your zone or affected URL
Cloudflare Docs
Trace a request with Cloudflare Trace · Cloudflare Fundamentals docs
Cloudflare Trace (beta) follows an HTTP/S request through Cloudflare’s reverse proxy to your origin. Use this tool to understand how different Cloudflare configurations interact with an HTTP/S request for one of your hostnames. If the hostname you are testing is not proxied by Cloudflare, Cloudflare Trace will still return all the configurations...
From An unknown user
From An unknown user
arasseo.
arasseo.OP6d ago
the error still persists. this is the output from cf trace. basically all URLs that I wanted Snippets to run in front of them will trigger Error 1101 Worker threw exception. right now we're disabling all snippets because it breaks things.
ncano
ncano4d ago
are you using version management by any chance? sorry, the trace output doesn't contain anything abnormal. having one snippet enabled on some kind of path that i can access and run tests against would be very helpful — unless you're using version management, in which case unfortunately this is expected on dev and staging envs currently
arasseo.
arasseo.OP4d ago
does Snippets even have version management? or did you mean Snippets doesn't work as intended because workers version management is enabled somewhere? aren't snippets supposed to run before workers? if that logic is true then does it matter what settings we're changing from the workers dashboard (other than settings to add/remove custom domains)? does that even make any sense that snippets running in front of workers but workers settings affect how snippets running (settings other than custom domains I mean) - I thought they aren't supposed to mess with each other. Snippets can be triggered to run from some custom domains that were added from workers dashboard, okay sounds normal. but why settings other than to add/remove custom domains even affect how Snippets work? they're 2 different products tho - sounds strange that workers settings are messing with how snippets work
having one snippet enabled on some kind of path that i can access and run tests against would be very helpful
the problem is that, even when snippets is told to run on specific subdomain (i.e., a.domain.dev), it's giving errors for other URLs (i.e. s1.domain.dev). I put my CSS on cf Pages, when enabling one of the Snippets, it prevents the Pages subdomain to load because of that error 1xxx. this will break websites that needs to access the CSS when that Snippet is enabled it's even more frustrating because from customer's dashboard, not much useful error messages were displayed. https://snippets.0ms.dev/ so I added this custom domain from workers dashboard. it works fine. but after enabling Snippets for that subdomain, it shows 1xxx error.
ncano
ncano4d ago
this is weird, we will take a look
arasseo.
arasseo.OP4d ago
just in case, the code looks normal to us, not sure what went wrong
ncano
ncano4d ago
just to follow up on the question of versions, Snippets rules do have internal version management powered by Ruleset Engine (which we might expose later to customers), however in this particular scenario i meant Version Management product that is known to break Snippets
arasseo.
arasseo.OP4d ago
nah, I don't see this "Version Management product" anywhere
ncano
ncano4d ago
okay, so in the request flow Snippets execute first, and then request is passed to Workers what is the worker doing that executes after snippets? i've left my trace and findings in the support ticket #01433373 internally, but can confirm here that the id of the script that is throwing an exception is associated with your worker, not with your snippet
arasseo.
arasseo.OP4d ago
not sure, the code was a lot but definitely works normal for workers (without snippets). I haven't touched nor updated the workers code since the past 6 months because snippets has been working fine from the past few months. so not sure if there's anything wrong with the workers code, before this happened on march 18th, snippets works just fine without changing anything from the workers code. the error suddenly popped out of nowhere, that part is weird because it affected older snippets (last edited on march 15th). if changes was made by user then it's caused by the user, if it's not touched then how should the user know what went wrong
arasseo.
arasseo.OP4d ago
disabled the snippet now, you can check the subdomain again, now it's running directly from workers. okay, will look back the ticket
No description
ncano
ncano4d ago
another thing that i can confirm for now is that we haven't merged anything inside Snippets edge pipeline since February, so the change on March 18th might have happened in one of the dependencies that your Worker is calling (there are a few) ping me if you don't get any update from support in a few days, i'll remind them to keep looking at it
arasseo.
arasseo.OP4d ago
if what you mean by deps is the imports, then looking at the code, these are the only imports in the code
import parseRange from "range-parser";
import TimeAgo from "javascript-time-ago";
import en from "javascript-time-ago/locale/en";
import "regenerator-runtime/runtime.js";
import ky from "ky";
import { Ai } from "@cloudflare/ai";
import parseUrl from "parse-url";

// @ts-ignore
import * as mime from "mime-types";
import parseRange from "range-parser";
import TimeAgo from "javascript-time-ago";
import en from "javascript-time-ago/locale/en";
import "regenerator-runtime/runtime.js";
import ky from "ky";
import { Ai } from "@cloudflare/ai";
import parseUrl from "parse-url";

// @ts-ignore
import * as mime from "mime-types";
ncano
ncano4d ago
i mean other dev platform products that the worker is calling there are quite a few places where things could go wrong from the interop perspective, so they will need to narrow down where exactly that exception is thrown
arasseo.
arasseo.OP4d ago
it's tightly integrated with r2 and kv, but opening snippets.0ms.dev shouldn't trigger r2 or kv, it's only checking if the path doesn't match then simply return 404 page, which I believe that's why it's showing the 404 page
Walshy
Walshy4d ago
are you able to trigger the snippet again on some path so we can debug? you could enable the rule on a path like /workers-eng-snippet-debug or something
arasseo.
arasseo.OP4d ago
okay, here are 2 scenarios: 1. scenario one is using the prod worker where it's integrated with r2 and kv. kv is basically unused since the past 12 months and won't be triggered since we removed the old domain acted as endpoint to that kv. but the r2 still works as expected. 2. scenario two is using a fresly made, very simple worker script, to test if it's really the prod worker causing the problem or it's the entire Snippets (doesn't matter old or newly made snippet) causing the problem. Snippet code used see https://discord.com/channels/595317990191398933/1351598746487488542/1358826420863766618 Snippet rule used
(http.host eq "prod-workers-with-r2-snippets.0ms.dev" and starts_with(http.request.uri.path, "/workers-debug-with-snippets/")) or (http.host eq "snipdbg.0ms.dev" and starts_with(http.request.uri.path, "/workers-debug-with-snippets"))
(http.host eq "prod-workers-with-r2-snippets.0ms.dev" and starts_with(http.request.uri.path, "/workers-debug-with-snippets/")) or (http.host eq "snipdbg.0ms.dev" and starts_with(http.request.uri.path, "/workers-debug-with-snippets"))
Scenario one (prod worker with r2) a custom domain, to see if everything works without snippets running in front of it, using the same above snippets script: 1. https://prod-workers-with-r2.0ms.dev/ 2. https://prod-workers-with-r2.0ms.dev/workers-debug-with-snippets/ 3. https://prod-workers-with-r2.0ms.dev/workers-debug-without-snippets/ a custom domain, to see if everything works with snippets running in front of it, using the same above snippets script: 1. https://prod-workers-with-r2-snippets.0ms.dev/ 2. https://prod-workers-with-r2-snippets.0ms.dev/workers-debug-with-snippets/ 3. https://prod-workers-with-r2-snippets.0ms.dev/workers-debug-without-snippets/ Scenario two (freshly made worker script) a custom domain, to see if everything works with snippets running in front of the /workers-debug-with-snippets path, using the same above snippets script: 1. https://snipdbg.0ms.dev/ 2. https://snipdbg.0ms.dev/workers-debug-with-snippets 3. https://snipdbg.0ms.dev/workers-debug-without-snippets what's weird is that even the scenario two (freshly made worker script) won't work with snippets running in front of it the worker script
/**
* Welcome to Cloudflare Workers! This is your first worker.
*
* - Run "npm run dev" in your terminal to start a development server
* - Open a browser tab at http://localhost:8787/ to see your worker in action
* - Run "npm run deploy" to publish your worker
*
* Learn more at https://developers.cloudflare.com/workers/
*/


export default {
async fetch(request, env, ctx) {

const {
method,
headers,
url
} = request;
const searchParams = new URL(url).searchParams;

if (
method == "GET" &&
(url.toString().startsWith("https://snipdbg.0ms.dev/workers-debug-with-snippets"))) {

return new Response('This runs from the same worker script, with snippets in front of it.');

} else if (
method == "GET" &&
(url.toString().startsWith("https://snipdbg.0ms.dev/workers-debug-without-snippets"))) {

return new Response('This runs from the same worker script, without snippets in front of it.');

}

const temp = "Hi,\n\nTry these URLs to debug:\n\n1. https://snipdbg.0ms.dev/workers-debug-with-snippets\n2. https://snipdbg.0ms.dev/workers-debug-without-snippets";

return new Response(temp);
},
};
/**
* Welcome to Cloudflare Workers! This is your first worker.
*
* - Run "npm run dev" in your terminal to start a development server
* - Open a browser tab at http://localhost:8787/ to see your worker in action
* - Run "npm run deploy" to publish your worker
*
* Learn more at https://developers.cloudflare.com/workers/
*/


export default {
async fetch(request, env, ctx) {

const {
method,
headers,
url
} = request;
const searchParams = new URL(url).searchParams;

if (
method == "GET" &&
(url.toString().startsWith("https://snipdbg.0ms.dev/workers-debug-with-snippets"))) {

return new Response('This runs from the same worker script, with snippets in front of it.');

} else if (
method == "GET" &&
(url.toString().startsWith("https://snipdbg.0ms.dev/workers-debug-without-snippets"))) {

return new Response('This runs from the same worker script, without snippets in front of it.');

}

const temp = "Hi,\n\nTry these URLs to debug:\n\n1. https://snipdbg.0ms.dev/workers-debug-with-snippets\n2. https://snipdbg.0ms.dev/workers-debug-without-snippets";

return new Response(temp);
},
};

Did you find this page helpful?