From 3d227e0798771a5ed85238b26bd930d4ca7a3d3e Mon Sep 17 00:00:00 2001 From: Neal Shah <30693865+ProgrammerIn-wonderland@users.noreply.github.com> Date: Thu, 31 Jul 2025 12:34:19 -0700 Subject: [PATCH] Update worker limit (#1405) * Update worker limit * Handle error for when a mapping has no routes --- src/backend/src/services/worker/WorkerService.js | 4 ++-- src/backend/src/services/worker/src/s2w-router.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/src/services/worker/WorkerService.js b/src/backend/src/services/worker/WorkerService.js index 125ada37e..03c2ec811 100644 --- a/src/backend/src/services/worker/WorkerService.js +++ b/src/backend/src/services/worker/WorkerService.js @@ -198,8 +198,8 @@ class WorkerService extends BaseService { const currentDomains = await svc_su.sudo(Context.get("actor").get_related_actor(UserActorType), async () => { return (await es_subdomain.select({ predicate: new StartsWith({ key: "subdomain", value: "workers.puter." }) })); }); - if (currentDomains.length >= 10) { - throw APIError.create('subdomain_limit_reached', null, {isWorker: true, limit: 10}); + if (currentDomains.length >= 100) { + throw APIError.create('subdomain_limit_reached', null, {isWorker: true, limit: 100}); } if (this.global_config.reserved_words.includes(workerName)) { diff --git a/src/backend/src/services/worker/src/s2w-router.js b/src/backend/src/services/worker/src/s2w-router.js index ac954d638..829920330 100644 --- a/src/backend/src/services/worker/src/s2w-router.js +++ b/src/backend/src/services/worker/src/s2w-router.js @@ -78,6 +78,9 @@ function inits2w() { if (this.handleCors && event.request.method === "OPTIONS" && !mappings) { return this.handleOptions(event.request); } + if (!mappings) { + return new Response(`No routes for given request type ${event.request.method}`, {status: 404}); + } const url = new URL(event.request.url); try { for (const mapping of mappings) {