Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/node): set process.env as own property #27891

Merged
merged 3 commits into from
Jan 31, 2025

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Jan 31, 2025

Fixes [email protected]

% deno eval "import 'npm:[email protected]'" # main
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'GOOGLE_SDK_NODE_LOGGING')
    at Object.log (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/google-logging-utils/0.0.2/build/src/logging-utils.js:356:36)
    at Object.<anonymous> (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/gcp-metadata/6.1.1/build/src/index.js:52:20)
    at Object.<anonymous> (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/gcp-metadata/6.1.1/build/src/index.js:409:4)
    at Module._compile (node:module:745:34)
    at loadMaybeCjs (node:module:770:10)
    at Object.Module._extensions..js (node:module:755:12)
    at Module.load (node:module:662:32)
    at Function.Module._load (node:module:534:12)
    at Module.require (node:module:681:19)
    at require (node:module:812:16)

% target/debug/deno eval "import 'npm:[email protected]'" # this PR

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice!

@nathanwhit
Copy link
Member

I think pretty much all of the properties should be own properties:

❯ node -e 'console.log(Object.getOwnPropertyNames(process))'
[
  'version',
  'versions',
  'arch',
  'platform',
  'release',
  '_rawDebug',
  'moduleLoadList',
  'binding',
  '_linkedBinding',
  '_events',
  '_eventsCount',
  '_maxListeners',
  'domain',
  '_exiting',
  'exitCode',
  'config',
  'dlopen',
  'uptime',
  '_getActiveRequests',
  '_getActiveHandles',
  'getActiveResourcesInfo',
  'reallyExit',
  '_kill',
  'loadEnvFile',
  'cpuUsage',
  'resourceUsage',
  'memoryUsage',
  'constrainedMemory',
  'availableMemory',
  'kill',
  'exit',
  'ref',
  'unref',
  'finalization',
  'hrtime',
  'openStdin',
  'getuid',
  'geteuid',
  'getgid',
  'getegid',
  'getgroups',
  'allowedNodeEnvironmentFlags',
  'features',
  '_fatalException',
  'setUncaughtExceptionCaptureCallback',
  'hasUncaughtExceptionCaptureCallback',
  'emitWarning',
  'nextTick',
  '_tickCallback',
  'sourceMapsEnabled',
  'setSourceMapsEnabled',
  'getBuiltinModule',
  '_debugProcess',
  '_debugEnd',
  '_startProfilerIdleNotifier',
  '_stopProfilerIdleNotifier',
  'stdout',
  'stdin',
  'stderr',
  'abort',
  'umask',
  'chdir',
  'cwd',
  'initgroups',
  'setgroups',
  'setegid',
  'seteuid',
  'setgid',
  'setuid',
  'env',
  'title',
  'argv',
  'execArgv',
  'pid',
  'ppid',
  'execPath',
  'debugPort',
  'argv0',
  '_eval',
  '_preload_modules',
  'report'
]
❯ deno eval 'console.log(Object.getOwnPropertyNames(process))'
[
  "_events",
  "_eventsCount",
  "_maxListeners",
  "versions",
  "stdin",
  "stdout",
  "stderr"
]

Co-authored-by: Yoshiya Hinosawa <[email protected]>
Signed-off-by: Divy Srivastava <[email protected]>
@littledivy littledivy merged commit 08cc221 into denoland:main Jan 31, 2025
18 checks passed
@WesleyWaffles
Copy link

Thanks for this fix! I was banging my head against trying to get the firebase-admin npm package to work and was getting this same error until I pulled the canary build with this fix. 🙇‍♂️

nyannyacha added a commit to nyannyacha/edge-runtime that referenced this pull request Feb 3, 2025
nyannyacha added a commit to supabase/edge-runtime that referenced this pull request Feb 3, 2025
littledivy added a commit that referenced this pull request Feb 3, 2025
Ref #27891 (comment)

```
% deno eval 'console.log(Object.getOwnPropertyNames(process))'
[
  "_events",
  "_eventsCount",
  "_maxListeners",
  "versions",
  "stdin",
  "stdout",
  "stderr"
]

% target/debug/deno eval 'console.log(Object.getOwnPropertyNames(process))'
[
  "_events",
  "_eventsCount",
  "_maxListeners",
  "release",
  "arch",
  "report",
  "title",
  "argv",
  "argv0",
  "chdir",
  "config",
  "cpuUsage",
  "cwd",
  "env",
  "execArgv",
  "exit",
  "abort",
  "reallyExit",
  "_exiting",
  "exitCode",
  "mainModule",
  "nextTick",
  "dlopen",
  "pid",
  "ppid",
  "platform",
  "setSourceMapsEnabled",
  "hrtime",
  "_kill",
  "kill",
  "memoryUsage",
  "stderr",
  "stdin",
  "stdout",
  "version",
  "versions",
  "emitWarning",
  "binding",
  "umask",
  "getgid",
  "getuid",
  "getegid",
  "geteuid",
  "getBuiltinModule",
  "_eval",
  "execPath",
  "uptime",
  "allowedNodeEnvironmentFlags",
  "features",
  "noDeprecation"
]
```
bartlomieju pushed a commit that referenced this pull request Feb 12, 2025
Fixes `[email protected]`

```
% deno eval "import 'npm:[email protected]'" # main
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'GOOGLE_SDK_NODE_LOGGING')
    at Object.log (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/google-logging-utils/0.0.2/build/src/logging-utils.js:356:36)
    at Object.<anonymous> (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/gcp-metadata/6.1.1/build/src/index.js:52:20)
    at Object.<anonymous> (file:///Users/divy/Library/Caches/deno/npm/registry.npmjs.org/gcp-metadata/6.1.1/build/src/index.js:409:4)
    at Module._compile (node:module:745:34)
    at loadMaybeCjs (node:module:770:10)
    at Object.Module._extensions..js (node:module:755:12)
    at Module.load (node:module:662:32)
    at Function.Module._load (node:module:534:12)
    at Module.require (node:module:681:19)
    at require (node:module:812:16)

% target/debug/deno eval "import 'npm:[email protected]'" # this PR
```

---------

Signed-off-by: Divy Srivastava <[email protected]>
Co-authored-by: Yoshiya Hinosawa <[email protected]>
bartlomieju pushed a commit that referenced this pull request Feb 12, 2025
Ref #27891 (comment)

```
% deno eval 'console.log(Object.getOwnPropertyNames(process))'
[
  "_events",
  "_eventsCount",
  "_maxListeners",
  "versions",
  "stdin",
  "stdout",
  "stderr"
]

% target/debug/deno eval 'console.log(Object.getOwnPropertyNames(process))'
[
  "_events",
  "_eventsCount",
  "_maxListeners",
  "release",
  "arch",
  "report",
  "title",
  "argv",
  "argv0",
  "chdir",
  "config",
  "cpuUsage",
  "cwd",
  "env",
  "execArgv",
  "exit",
  "abort",
  "reallyExit",
  "_exiting",
  "exitCode",
  "mainModule",
  "nextTick",
  "dlopen",
  "pid",
  "ppid",
  "platform",
  "setSourceMapsEnabled",
  "hrtime",
  "_kill",
  "kill",
  "memoryUsage",
  "stderr",
  "stdin",
  "stdout",
  "version",
  "versions",
  "emitWarning",
  "binding",
  "umask",
  "getgid",
  "getuid",
  "getegid",
  "geteuid",
  "getBuiltinModule",
  "_eval",
  "execPath",
  "uptime",
  "allowedNodeEnvironmentFlags",
  "features",
  "noDeprecation"
]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants