notion-sdk-js icon indicating copy to clipboard operation
notion-sdk-js copied to clipboard

Use isomorphic fetch

Open sv2dev opened this issue 1 year ago • 1 comments

Since fetch is stable in the current LTS version of Node, I don't see any good reason for using node-fetch or any other solution than the web standard.

sv2dev avatar May 03 '24 20:05 sv2dev

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 03 '24 20:05 CLAassistant

👋 Hi from Notion's API team! Thanks @huv1k @sv2dev for bumping this issue, looks like it's been open for a while. I don't have much context on this yet, though it looks like you have merge conflicts. I recently added a test that relies on us overriding the fetch passed to the Client constructor so we may need to restructure that if we go this route. Beyond that, I'll check with some folks internally to get caught up on our stance re: isomorphic fetch and see if I can get you an update here!

ksinder avatar Apr 10 '25 15:04 ksinder

Hey @ksinder, thanks for picking this up. I resolved the conflicts and fixed the test.

sv2dev avatar Apr 10 '25 17:04 sv2dev

Getting rid of the node-fetch dependency seems great, but I think ideally we still want to allow passing a fetch constructor argument into the Client to support everyone's individual use-case, instead of only supporting isomorphic fetch. Is there any way to reference a common static type for fetch to get rid of the node-fetch dependency without regressing the customizability?

ksinder avatar Apr 23 '25 14:04 ksinder

Okay, I reverted the typings and client parameter related stuff. Now we should be able to use a different fetch implementation like node-fetch, and the Web API fetch is used by default.

sv2dev avatar Apr 25 '25 19:04 sv2dev

Amazing, thank you so much for the clean change and making all those changes, and for your patience! This looks good to me and worth shipping as part of our next version release.

ksinder avatar May 03 '25 16:05 ksinder