Live data from Hacker News

Supabase Edge Runtime: Self-Hosted Deno Functions

supabase.com

81–90 of 105 posts

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#81

I’ve been using Deno Deploy as as a paying customer for the last year, both because I want to support what they’re doing and because I appreciate the amazingly tight deployment times. That said, it’s suffered for the lack of access to the file system or dynamic imports which makes things like MDX challenging without adding additional build steps. Do Supabase Edge Functions allow read/write file system access? What ab…

[Supabase engineer & Author of the blog post]

Hi Mark, hosted Supabase Edge Functions would still run on Deno Deploy, so those limitations would still exist. However, we plan to introduce file system access via integration with Supabase Storage. This is still a rough idea stage, maybe we'll have a solid answer in a couple of months :)

For dynamic imports, we haven't looked into it since Supabase users haven't requested it. If you can open an issue on Edge Runtime repo [0] and explain how you intend to use them, we can probably work on a solution.

[0] https://github.com/supabase/edge-runtime/issues

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#82
post #72

Earlier quoted context omitted.

Open question: what are the benefits of replacing Lambda with this new service, if you’re not using any other Supabase functionalities? Our Lambdas are currently written in Typescript and built with esbuild. We zip them and push to AWS.

These would boot faster since you don’t have to boot a whole OS, just a V8 VM. Downside is compatibility, your lambdas would have to be largely rewritten (especially if they rely on any other AWS services). It’s also probably more expensive since you’d have to keep a EC2 or something up running this. Kinda wish Amazon would have an alternative runtime that was more like this. They kinda do with lambda@edge, but that’…

Lambda@Edge is a great solution for the locality problem (CloudFront can just route to the nearest edge function, and despite certain headaches, it works well), but what it doesn’t help to solve is the cold start problem. In a sense Lambda@Edge works against it, as provisioned concurrency is only supported for ‘regular’ Lambda functions.

At a certain level of scale, the cost of spinning of an ALB Fargate task (which could run these servers relatively easily) ends up being relatively negligible. Although that’s certainly not true for every org.

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#83

This is the third big release this week (along with a Postgres Pooler and a Logging Server). If you're wondering why there are so many, we generally "build for three months" then do all of our big product announcements in a "Launch Week". We're 2 days into this Launch Week so there will be a few more releases to come.

I think this is great, but a growing question in my mind from these is what is the long tail plan for maintenance of this constellation of stuff? Especially because you guys are building on technologies that you can’t really just casually find developers for eg Elixir and Haskell. I keep seeing missing critical features in Realtime and Postgrest, and I know these are armies of 1-2, but it does kind of worry me when I…

> I keep seeing missing critical features in Postgrest

> Example: https://github.com/PostgREST/postgrest/issues/915

> while there isn’t much action on existing issues.

That one is planned but it's not high priority because it can be solved already with SQL functions[1][2] in a flexible and secure way(GROUP BY is an expensive operation, it cannot be exposed to the frontend just like that).

I do get that some conveniences on the JS libraries are missing but they're not blockers(or critical features IMHO).

[1]: https://postgrest.org/en/stable/api.html#stored-procedures

[2]: https://supabase.com/docs/reference/javascript/rpc

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#84

What does deno give you over node? I am assuming by first impression there are some standard libraries in these functions which aren't available otherwise in node?

[Supabase Engineer & Author of the blog post]

What stands out for me about Deno over Node is its overall architecture.

1. It has a built-in permissions model [0] which gives end-user the control over what resources a script can access within a system.

2. As mentioned in the blog post, Deno runtime is extremely modular you can customize it per use case. This helps with security, performance and overall developer experience.

3. Deno has first-class support for Web Platform APIs, which reduces the need for reliance on third-party modules for simple tasks. A good example here is the native fetch module shipped with Deno. Unlike in Node, you don't end up with multiple modules implementing fetch.

4. Built-in tooling - Deno CLI has built-in tooling for formatting, linting, doc generation, benchmarking, etc. This is great for developer ergonomics, especially for people from Go and Rust backgrounds.

[0] https://deno.land/manual@v1.32.2/basics/permissions

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#85

Earlier quoted context omitted.

I think this is great, but a growing question in my mind from these is what is the long tail plan for maintenance of this constellation of stuff? Especially because you guys are building on technologies that you can’t really just casually find developers for eg Elixir and Haskell. I keep seeing missing critical features in Realtime and Postgrest, and I know these are armies of 1-2, but it does kind of worry me when I…

> I keep seeing missing critical features in Postgrest > Example: https://github.com/PostgREST/postgrest/issues/915 > while there isn’t much action on existing issues. That one is planned but it's not high priority because it can be solved already with SQL functions[1][2] in a flexible and secure way(GROUP BY is an expensive operation, it cannot be exposed to the frontend just like that). I do get that some convenien…

Thanks for the response Steve. In general, I unfortunately don’t agree that this is a “convenience” feature or that this alternative you brought up is “flexible”.

This way of doing things is just so much more painful in terms of ergonomics we elected to instead escape hatch into raw SQL with a different library (Sequelize) in our case. Black boxing some of our business logic into views or RPC is just not something devs I work with are comfortable with. Having business logic live in the db like this just unlocks a whole new world of pain for people who aren’t used to it. Now I have a whole new class of problems too, now I have to have unit tests in the db with pgTAP and now I as a dev have to decide when and where this kind of logic should go in the db vs in the application layer and how to test it. In general I would really call this not a viable alternative at all unless there are some comprehensive design documents that say “do this stuff as RPC in the db because it makes sense to do it there, do this stuff in the application layer”. When I tried selling this ‘workaround’ in its current form to other devs in my org, they all balked at it.

Maybe I’m thinking about how Postgrest is supposed to work fundamentally wrong and all of this stuff is generally supposed to live in the db. But there certainly isn’t any guidance directing that in documentation currently. And in general I think if you want to advocate for a design where you split business logic between your application layer and your db there should be a plethora of examples where this has been done successfully, especially because that idea goes very much against how a typical developer thinks about system design.

It’s weird because I can do everything else in a “typical CRUD app” the nice way with Postgrest except this. It feels like the part of the codebases where I have to deal with this (and indeed, it comes up every time) is a constant wart in an otherwise pretty good setup.

Please don’t take this as me hating on Postgrest. I think it’s absolutely fabulous software and I am in genuine awe of what you have achieved. I can only aspire to have your work ethic and vision when it comes to this kind of stuff. I just want to help you see how myself and the devs I work with use it in real life and how they react to Postgrest in the context of using it when trying to make maintained business applications over years of time.

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#86

Is there something about Deno that makes Edge functions good to be based on it - Netlify also has its Edge functions in Deno https://docs.netlify.com/edge-functions/overview/ maybe just coincidence, but seen two edge functions in Deno implementations in the last hour so makes me wonder.

Honestly Deno is a pain in the ass to work with which is what put us off from continuing to use Supabase.

The developer tooling is just not mature yet, and buggy in lots of ways.

Edge technologies are nice until they get into your way of work.

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#87

Earlier quoted context omitted.

I’ve been using Cloudflare workers for a while now and I have to disagree. There are entire classes of problems I no longer worry about with Workers and can just focus on building. My search history is a reflection of that. I’m no longer looking up “how do I put this thing in a Jails or container to limit exposure?” “how do I properly secure an SSH server?” “what is the magic incantation in my NGinx configuration to…

I'm afraid you're trying to make system administration look much harder than it actually is. As an example, adding good defaults to your nginx config is automated by certbot, or you could use caddy. You could run your apps statelessly by containerizing your applications or by simply writing Ansible playbooks and then not have to worry about upgrades - you simply deploy the application on the new server and spin down…

> simply writing Ansible playbooks

As someone who has been doing this for some years now, it is not simple.

To be fair, you can write a simple Ansible playbook if Ansible isn't doing much for you. But if you're using Ansible to manage things which are themselves not simple (like "just install a Node runtime please") you are at the mercy of whatever shell script Ansible eventually ends up calling.

I've been through Ubuntu version updates and Ansible really didn't help with issues like "that package is now no longer in the PPA you got it from".

Administration doesn't take a lot of my time, but when I do need to do it, it can take a solid day of focus to make sure I know what I'm doing, make the changes, recover from the pitfalls I always forget (e.g. "this Ansible step fails in --check mode because it depends on a file that is created in an earlier step, which doesn't happen in check mode") then work through the inevitable issues. I wouldn't want to do it without Ansible, but it's not "simply" anything.

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#88
post #86

Is there something about Deno that makes Edge functions good to be based on it - Netlify also has its Edge functions in Deno https://docs.netlify.com/edge-functions/overview/ maybe just coincidence, but seen two edge functions in Deno implementations in the last hour so makes me wonder.

Honestly Deno is a pain in the ass to work with which is what put us off from continuing to use Supabase. The developer tooling is just not mature yet, and buggy in lots of ways. Edge technologies are nice until they get into your way of work.

Can you share some examples where the tooling fell short?

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#89
I like the direction with working towards eliminating korg here!

One of the reasons I chose Directus over Supabase (they can also be used together, it's not either/or) is that I'm one of the rare engineers out there that doesn't like containers.

Well, to be more specific: I don't like containers for languages that don't need them. For example, a node monorepo doesn't really need a container, it's just a npm install away from working pretty much anywhere. Or a go static binary. Containers are great for languages/stacks that have more difficult dependencies.

That being said, Supabase just had too many moving parts for me. I'm allergic to complexity. I want my stack to be as basic as possible, I want to innovate in the business problem domain space, not the tech stack space.

I totally get the "don't reinvent the wheel" idea, but the complexity of a Supabase installation when you look under the hood at what's going on inside the container really turned me off. With Directus, it's just a npm dependency to your node app, nothing else. It'll automatically reflect over your database schema, and progressively enhance it with additional capabilities as you choose, automatic REST and GraphQL APIs with detailed and comprehensive configurable role based row-level security. An automatic and very capable Vue based admin app, and lots of other goodies. All the code is open source, well structured, easy to debug (it runs in-process, it's all just nodejs), and to fork/enhance as needed. Doing the same with Supabase would be difficult, to say the least.

I like the direction Supabase is moving with this - consolidating back to more of a monorepo with less internal services and dependencies.

I really like the Supabase Postgrest-js client too. One of the things that troubles me about directus is the home-grown DSL for queries. It's limiting and error prone, and impossible to do anything complex (you currently can't even query json fields, though that's coming soon I think). I think Supabase did a really good job with isomorphism with that library.

Another thing I think Supabase did right is to just focus on Postgres. Directus is hamstrung by their knex backend and multi-db support, imho.

I've been thinking that if I were to build something similar from scratch, I think I'd lean heavily on sequelize and build the whole shebang around that. It already has a very mature and capable DSL for queries that can be adapted to isomorphism with some symbol mapping and injection protection. It has the capability of enforced row-level security with scopes, and you don't have to deal with the issues around Postgrest or Directus' custom DSL. The only thing it doesn't have is automatic schema reflection - it's a model-first ORM. That's a solvable problem though.

I've had an "itch" about this for a while. I may be "retiring" in a year or two, and I'm seriously considering taking all the lessons learned from both Supabase and Directus and trying to create a super-simple sequelize based monorepo option as my next thing.

Re: Supabase Edge Runtime: Self-Hosted Deno Functions

#90
post #88
post #86

Earlier quoted context omitted.

Honestly Deno is a pain in the ass to work with which is what put us off from continuing to use Supabase. The developer tooling is just not mature yet, and buggy in lots of ways. Edge technologies are nice until they get into your way of work.

Can you share some examples where the tooling fell short?

https://github.com/orgs/supabase/discussions/8779

That one lol. Are there any solid reasons to not support other runtimes? Appwrite for example supports Nodejs.

Post reply on HN