Skip to content

Cannot resolve "node-fetch-native/native/proxy" from "..." and externals are not allowed! #140

@vejja

Description

@vejja

Environment

giget 1.2.1
Node 18
Nuxt 3.8.2, 3.9.0, 3.9.1
Nitro 2.8.1

Reproduction

Sorry unable to provide repro as this only appears in workers environment
This was reported on Cloudflare, Vercel

Does not appear in NodeJS, local environments

Describe the bug

Initial bug report was filed in Nuxt-Security there
We initially thought the issue was on our side but were unable to reproduce

Then one user filed logs, and we realized the error was triggered by giget while trying to use node-fetch-native in Workers environments

Additional context

  • The error did not exist before Nuxt 3.8.2
  • Nuxt 3.8.2 upgraded nitropack to 2.8.1
  • [email protected] upgraded node-fetch-native to 1.6.1
  • The log report shows that giget is trying to use node-fetch-native's proxy feature, which was not available in 1.4.1
  • Nuxt-Security uses node-fetch-native 1.4.1

This looks like a version dependency mismatch on node-fetch-native
This is very strange because package managers should usually be able to resolve the correct version without any issue
In fact, in NodeJS environments the issue does not exist

However for some unknown reason, it seems to affect Workers environment

Logs

(node-resolve plugin) Could not resolve import "node-fetch-native/native/proxy" in /opt/_work/myproject/node_modules/.pnpm/[email protected]/node_modules/giget/dist/index.mjs using exports defined in /opt/_work/myproject/node_modules/.pnpm/[email protected]/node_modules/node-fetch-native/package.json.
Error:  [nitro] Error: Cannot resolve "node-fetch-native/native/proxy" from "/opt/_work/myproject/node_modules/.pnpm/[email protected]/node_modules/giget/dist/index.mjs" and externals are not allowed!


undefined
Error:  Cannot resolve "node-fetch-native/native/proxy" from "/opt/_work/myproject/node_modules/.pnpm/[email protected]/node_modules/giget/dist/index.mjs" and externals are not allowed!
  at Object.resolveId (node_modules/.pnpm/[email protected]/node_modules/nitropack/dist/shared/nitro.4ea992bc.mjs:1973:17)
  at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18542:28)
  at async resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17211:26)
  at async ModuleLoader.resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17625:15)
  at async Object.resolveId (node_modules/.pnpm/@[email protected][email protected]/node_modules/@rollup/plugin-commonjs/dist/es/index.js:588:10)
  at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18542:28)
  at async resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17211:26)
  at async ModuleLoader.resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17625:15)
  at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18542:28)
  at async resolveId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:17211:26) 

Error:  Cannot resolve "node-fetch-native/native/proxy" from "/opt/_work/myproject/node_modules/.pnpm/[email protected]/node_modules/giget/dist/index.mjs" and externals are not allowed!
 ELIFECYCLE  Command failed with exit code 1.
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions