https://www.boundaryml.com logo
🟡 Issues with BAML clients in Supabase edge funct...
# questions
s
Has anyone worked on a project that uses BAML clients in Supabase edge functions? I'm struggling to get the deployment to work cause the packaging isn't getting the imports correctly, so this might be more a Supabase question. But asking in case anyone also ran into this!
a
Do you know what runtime their edge functions run in? Is it just nodejs or something else?
Usually you need to make sure to bundle the native module correctly. We have some instructions for nodejs where we have to configure webpack with a .node native module loader
If the edgr functions run on a browser environment baml wont be able to load
But basically what you just need to find is “how to run .node native module in supabase”
Theres other packages that have native modules that are super popular, like “sharp”
You can try to send the error you get here
s
Thanks! From the docs, I see > Runtime: Supabase Edge Runtime (Deno compatible runtime with TypeScript first) https://supabase.com/docs/guides/functions I'm working through some node/npm concepts, will share the error if I can't figure it out yet.
a
s
Hm maybe. I was trying a hacky way to generate the baml_client within the
supabase/function/<FUNCTION>/
folder since it packages that for deployment, but then found out that
baml_client
files reference imports without file extension (.ts), but Deno (runtime for Supabase edge function) requires file extensions in the imports
So issue becomes what was discussed in this GitHub issue I think: https://github.com/BoundaryML/baml/issues/1213
I wonder if it'd be easier to just change the compute platform I'm deploying to, maybe Cloudflare workers or something 🤔
a
cloudflare workers will have similar issues. I would recommend fly.io or something that potentially uses docker, let me know what you end up deciding. Cloudflare worker doesnt work since their runtime is the V8 browser runtime (and baml only supports nodejs compatible runtimes)
s
Oh I see, thanks for that. Let me check out fly.io, I'll let you know what I get working 👍
5 Views