Skip to content

Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.

fix(worker): refuse a SERVER_INTERNAL_URL that is not a valid http(s) URL (#389)

Felix-Ayush2a942217fad9
diff --git a/worker/src/env.ts b/worker/src/env.ts
index 4cce2f0b..8b091920 100644
--- a/worker/src/env.ts
+++ b/worker/src/env.ts
@@ -48,6 +48,16 @@ export function loadWorkerEnv(
"SERVER_INTERNAL_URL is not set, so this worker does not know where to hand a routine run.",
);
}
+ try {
+ const parsed = new URL(serverInternalUrl);
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
+ throw new Error("not http(s)");
+ }
+ } catch {
+ throw new Error(
+ "SERVER_INTERNAL_URL must be a valid http(s) URL, so this worker knows where to hand a routine run.",
+ );
+ }
const databaseUrl = environment.DATABASE_URL?.trim();
if (!databaseUrl) {