meyer
05/22/2023, 3:04 PMnode-fetch
usage in the notion client. node-fetch
is not made for use with cloudflare workers. it's also unnecessary since fetch support is built in to the worker environment.
you can pass in your own fetch implementation to the client (https://github.com/makenotion/notion-sdk-js/blob/02ad37d949bed482d63a36cd9408f8a3c222bccf/src/Client.ts#L124). that'll get you halfway there. the other half would involve either preventing node-fetch
from resolving and muffling the error or resolving it to a noop. you can do this one of several ways:
1. bundle the worker yourself and do the aliasing in the bundler config
2. alias the module with your node package manager if it supports it (i.e. yarn resolutions, pnpm as well probably?)
https://cdn.discordapp.com/attachments/910978223968518144/1110221639670583316/image.png▾