[HN Gopher] Edge functions: Node and native NPM compatibility
___________________________________________________________________
Edge functions: Node and native NPM compatibility
Author : jacobwg
Score : 49 points
Date : 2023-12-12 18:59 UTC (4 hours ago)
(HTM) web link (supabase.com)
(TXT) w3m dump (supabase.com)
| tomComb wrote:
| > We run an open source Deno server for hosting Edge Functions
| called Supabase Edge Runtime.
|
| With full npm and node compatibility. Interesting.
| kiwicopple wrote:
| source: https://github.com/supabase/edge-runtime
|
| we needed this to get feature parity across local, the
| platform, and self-hosting
| laktek wrote:
| Hey, thanks for sharing this on HN! I'm one of the Edge Functions
| developers at Supabase and co-author of the blog post. We are
| very excited about releasing npm support and looking forward to
| seeing how the community build awesome apps with the Supabase
| stack.
|
| I am happy to answer any questions or receive feedback.
| andrew_ wrote:
| how deep does the support go? i.e. can we safely import from
| node platform builtins like `os` or are the same bundling
| gymnastics still required there? (fwiw this is one of the major
| issues with vercel's edge funcs)
| laktek wrote:
| Most builtin modules should work (except for things like `vm`
| which we cannot safely sandbox in edge runtime). Deno has a
| good guide on the compatibility of built-in modules
| https://docs.deno.com/runtime/manual/node/compatibility
|
| You can do: ``` import os from "node:os"
| console.log(os.hostname()) ```
|
| and it should just work both locally and when deployed. No
| extra steps needed.
| kiwicopple wrote:
| hey hn, supabase ceo here
|
| this is the #1 feature request from our community wrt Edge
| Functions. Our Functions run Deno, and so a lot of developers
| struggle to migrate from Node. This update solves that. It was a
| lot of work - in the words of one of the developers: "the hardest
| thing I have implemented".
|
| It's nice because it brings 100% feature parity across local dev,
| the platform, and self-hosting.
|
| We also added a Sentry integration for observability and
| "Regional Invocations" for connecting to a Function in one
| particular region (useful if you want to execute a Function close
| to your database).
|
| I'm just clocking off but the engineer who shipped this is waking
| up and will be around for any technical discussion.
| KRAKRISMOTT wrote:
| Do you support Prisma? I don't recommend using Drizzle because
| their migrations tool is completely proprietary and closed
| source, but they bundle it with their open source offering in a
| bait and switch.
| laktek wrote:
| I haven't tried Prisma myself, but hopefully this guide
| should work with Edge Functions with npm
| https://supabase.com/partners/integrations/prisma
| willsmith72 wrote:
| That's not talking about edge functions specifically though
| is it? Surely there are extra steps required
|
| If not, I'm shocked and very impressed. I wouldn't have
| expected prisma to work at all
| sorenbs wrote:
| [delayed]
| revskill wrote:
| Cloudflare, please take a look !
| d0100 wrote:
| Great, I paused my project just waiting on this issue
|
| These last months open source has churned out several projects
| that are components to what I'm experimenting on and it feels
| great to be able to build on top of solid projects
| Karellen wrote:
| I'm looking for compatibility tables/information, but can't find
| the right place to look.
|
| Anyone have any idea how well Edge Functions for Javascript works
| with Edge's Javascript functions?
| montroser wrote:
| I bet this is cool in some way, but old me can't help but compare
| this approach to the delightful horror story here from some
| decades ago...
|
| https://thedailywtf.com/articles/the-inner-json-effect
___________________________________________________________________
(page generated 2023-12-12 23:00 UTC)