Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/functions-compiler/src/shim/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const deno = Object.freeze({

(globalThis as unknown as { Deno: unknown }).Deno = deno;
(globalThis as unknown as { Buffer: typeof Buffer }).Buffer = Buffer;
// workerd reports a fixed v22.19.0, which SDKs forward (Stripe in its user agent).
if (typeof process !== "undefined") (process as { version: string }).version = "v22.23.4";
// workerd's enterWith() is a stub that throws; libraries such as Stagehand
// call it to seed a context they also pass explicitly, so a no-op keeps them
// working. Probed on a throwaway instance so a future native implementation is
Expand Down
14 changes: 14 additions & 0 deletions packages/functions-compiler/test/process-version.e2e.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { expect, it } from "vitest";

import { bundleOrThrow } from "./helpers";
import { runInWorkerd } from "./workerd";

it("reports the patched Node version to user code", async () => {
const m = await bundleOrThrow(`
const atImport = process.version;
Deno.serve(() => Response.json({ atImport, atRequest: process.version }));
`);
const { status, text } = await runInWorkerd(m);
expect(status).toBe(200);
expect(JSON.parse(text)).toEqual({ atImport: "v22.23.4", atRequest: "v22.23.4" });
});
Loading