NangoHQ / nango

A single API for all your integrations.
https://www.nango.dev
Other
4.77k stars 432 forks source link

Convert @nangohq/node to @nangohq/js -- remove node dependencies #2068

Open lawrencecchen opened 6 months ago

lawrencecchen commented 6 months ago

I'm using Cloudflare Workers/Durable Objects and can't use the nango client libraries due to axios and other uses of node:crypto. I've been using a fetch wrapper instead:

async function nangoProxy(input: ProxyConfiguration) {
  return await fetch(`https://api.nango.dev/proxy/${input.endpoint}`, {
    headers: {
      "Content-Type": "application/json; charset=utf-8",
      Authorization: `Bearer ${env.NANGO_SECRET_KEY}`,
      "Provider-Config-Key": input.providerConfigKey ?? "",
      "Connection-Id": input.connectionId ?? "",
    },
    body: JSON.stringify(input.data),
    method: input.method,
  }).then((r) => r.json());
}

It would be great if the official library becomes edge compatible as well.

linear[bot] commented 6 months ago

NAN-820 Convert @nangohq/node to @nangohq/js -- remove node dependencies

bastienbeurier commented 4 months ago

Thanks for submitting this. Most people consume this SDK from their backend, but I understand that it's different in your case. Unfortunately we don't have a timeline to support this, but we will send an update when we do.

lawrencecchen commented 4 months ago

Most people consume this SDK from their backend

Just to clarify, I'm using nango from my cloudflare workers backend which is missing some node builtins.

But understand that bandwidth is limited -- would a PR here be accepted?

bastienbeurier commented 4 months ago

Got it.

Thanks for proposing to contribute, it's much appreciated.

What would be the nature of the contribution?