hand sketched logo of electrons orbiting a nucleus

What can I use instead of Supabase Edge Functions?

Whats the problem?

  • Deno is weird, scale ~hours
  • VSCode deno support is not smooth, scale ~hours
  • Supabase Edge Functions have had a lot of issues when running locally, ~10 hours

What are the requirements?

  • I want to quickly iterate on api endpoints
  • I want endpoints behind authentication
  • I want to hit OpenAI endpoints
  • Currently using Supabase for my managed Postgres database (most writes are client-side right now)

What are the alternatives?

Vercel Edge Functions

  • Runtime is V8, aka not Node.js -> so most packages that require node apis will not work
  • Max execution time 25 seconds
  • Max memory 128 MB
  • Code size limit
    • Hobby 1 MB
    • Pro 2 MB
    • Enterprise 4 MB
  • Other limits listed here

Evaluation:

  • runtime is v limited, for faster iteration I will need to use a different service

Vercel Serverless Functions

  • Runtime is Node.js v18 (default)
    • Supports Go, Python, Ruby
  • Configure max execution time in the function export const maxDuration = 10 // seconds
  • Configure max memory in vercel.json "memory": 128 (MB) up to 3008
  • Region default is Washington D.C.
    • Can be configured in function export const preferredRegion = ['iad', 'lax']

How will I do authentication

Looks like Supabase has good support for this via cookie based auth with a helpful package @supabase/ssr. Lets try it out...

  • first note that ssr is a replacement for the old auth-helpers-nextjs package
  • lets migrate https://supabase.com/docs/guides/auth/server-side/migrating-to-ssr-from-auth-helpers
  • that seems to be sorta working, but when i try to login I get signups not allowed for otp error -> never mind that was becuase I nuked the docker container and forgot to re-make my user
  • I wonder how this will all deploy to vercel? now that I turned next.config.js // output: 'export', off...

Others

On the Edge:

But do I even need Edge Functions? Perhaps I would benefit from setting up a simple node app somewhere?