diff --git a/.changeset/five-rules-call.md b/.changeset/five-rules-call.md new file mode 100644 index 000000000..3e3134ee0 --- /dev/null +++ b/.changeset/five-rules-call.md @@ -0,0 +1,5 @@ +--- +'@cloudflare/next-on-pages': patch +--- + +Fix `process.env` not being enumerable due to being a proxy. diff --git a/packages/next-on-pages/src/buildApplication/generateGlobalJs.ts b/packages/next-on-pages/src/buildApplication/generateGlobalJs.ts index f4c033fc0..7d28cdead 100644 --- a/packages/next-on-pages/src/buildApplication/generateGlobalJs.ts +++ b/packages/next-on-pages/src/buildApplication/generateGlobalJs.ts @@ -20,6 +20,9 @@ export function generateGlobalJs(): string { env: new Proxy( {}, { + ownKeys: () => Reflect.ownKeys(envAsyncLocalStorage.getStore()), + getOwnPropertyDescriptor: (_, ...args) => + Reflect.getOwnPropertyDescriptor(envAsyncLocalStorage.getStore(), ...args), get: (_, property) => Reflect.get(envAsyncLocalStorage.getStore(), property), set: (_, property, value) => Reflect.set(envAsyncLocalStorage.getStore(), property, value), }),