Skip to content

process.env not polyfilled for Edge Functions in CLI #1864

Closed
@hrishikesh-k

Description

@hrishikesh-k

Describe the bug

This report is coming from a user here: https://answers.netlify.com/t/82464

They're trying to use environment variables in their Next.js code using process.env which is native to any Next.js developer. Since the middleware is running on Edge Functions (in production as well as in CLI), the correct syntax is Deno.env instead of process.env. In our production environment, we polyfill this, so users can get a seamless experience. However, it appears that the polyfill is missing in CLI.

Steps to reproduce

There's a code example in the thread above, which can cause this issue.

Configuration

No response

Environment

Sharing my system details, but should happen on any system (with current latest version of CLI - v12.5.0):

System:
    OS: macOS 13.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 504.87 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.asdf/installs/nodejs/18.12.1/bin/node
    npm: 9.2.0 - ~/.asdf/plugins/nodejs/shims/npm

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions