I need to write a Supabase Edge Function that interacts with GetStream. But as Supabase Edge Functions are running via Deno, I am importing the package via JS Deliver as follows:
import { StreamChat } from "https://cdn.jsdelivr.net/npm/stream-chat";
When I am serving the Edge Function locally, via the
supabase functions serve test_chat --debug
I get the following error:
error: TS2305 [ERROR]: Module '"https://cdn.jsdelivr.net/npm/stream-chat.js"' has no exported member 'StreamChat'.
revealing that it does not try to fetch "stream-chat" but "stream-chat .js", which does not exist.
Has anyone already found a solution to this?
Many thanks in advance,
Usually with Deno, you should be able to use npm specifiers, where you prepend
npm:
to the package name, something like this:but this for some reason throws an error when you try to deploy. What I found that works is to use esm.sh.