Skip to content

Commit 7c36ab9

Browse files
committed
Fix Cloudflare Worker: use globalThis.process for safe env access
The Cloudflare Workers runtime does not define the process global at module evaluation time, even with nodejs_compat_populate_process_env. Use globalThis.process?.env?. with full optional chaining to safely handle this, matching the pattern used by the SDK itself in console_logger_transport.ts.
1 parent 5f56ce9 commit 7c36ab9

File tree

1 file changed

+1
-1
lines changed
  • packages/examples/cloudflare/src

1 file changed

+1
-1
lines changed

packages/examples/cloudflare/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const greeter = restate.service({
2525
});
2626

2727
const identityKeys =
28-
process.env.RESTATE_IDENTITY_KEYS?.split(",").filter(Boolean);
28+
globalThis.process?.env?.RESTATE_IDENTITY_KEYS?.split(",").filter(Boolean);
2929

3030
export default {
3131
fetch: restate.createEndpointHandler({ services: [greeter], identityKeys }),

0 commit comments

Comments
 (0)