question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Isomorphic SDK support

See original GitHub issue

Hey! Congratulations on public notion API and awesome work on minimal and typed js SDK 💯

As of the current version, this package seems to only work with node.js, which makes missing lots of opportunities for supporting non-nodejs environments such as Deno, Cloudflare workers, universal frameworks like Nuxt.js , and frontend libraries like vue-notion this can open LOTS of new opportunities for using sdk.

For this change, we need to avoid depending on got and using a universal alternative (fetch) API. Since request is already refactored, it would be easy to allow providing custom client implementation or creating multi-target bundles (see ohmyfetch as an example) that importing @notionhq/client be as is now but having @notionhq/client/isomorphic import (or /node import) that is preconfigured with either node-fetch or got or faster node clients like nodejs/undici / undici-fetch

I can propose a PR if above seems reasonable for purpose of notion-sdk.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:41
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
guntacommented, Nov 22, 2021

+1 Came here surprised to see that it doesn’t support Cloudflare Workers yet, since Notion API makes the perfect case for doing automation with 0-ms cold boot start server-less platforms.

I vote for having a requestClient parameter for flexibility, but at the same time I think also having support by default (ie. being tested and having official support) for most popular platforms outside Node would be a very important thing for the future of this project (and the growing community).

  • Deno
  • Cloudflare workers
  • Vercel functions
  • Universal frameworks
4reactions
b-zurgcommented, May 13, 2021

It looks like ky allows providing one’s own fetch function compatible with the browser API.

I don’t feel like ky provides a huge benefit over fetch - it’s not so hard to write one’s own wrappers around the API if need be and less abstractions usually means easier debugging in my experience.

I think passing in a fetch function is a good pattern though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SalesforceCommerceCloud/commerce-sdk-isomorphic - GitHub
Commerce SDK Isomorphic supports Fetch API options for node-fetch on server and whatwg-fetch on browser with a simple configuration. This sample code shows ......
Read more >
commerce-sdk-isomorphic - npm
Salesforce Commerce SDK Isomorphic. Latest version: 1.8.0, last published: 2 months ago. Start using commerce-sdk-isomorphic in your project ...
Read more >
commerce-sdk-isomorphic examples - CodeSandbox
Learn how to use commerce-sdk-isomorphic by viewing and forking example apps that make use of commerce-sdk-isomorphic on CodeSandbox. ; Latest version1.8.0.
Read more >
SmartClient™ SDK Release Notes
Please contact Isomorphic for details. Supported Servers. SmartClient 13.0 server-side components require a Java Servlets 2.3 compatible server (complete list ...
Read more >
Isomorphic Support | Enact
Isomorphic code layout is a special feature which builds projects in a JavaScript layout that can be potentially processed by any environment, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found