Supabase Functions
# off-topic
b
Supabase Functions
Supabase Functions
@User
h
Yeah
b
So I use most Node JS Libraries in pg using my SupaScript library
works really well
h
If supabase functions is ever a thing wud calls be limited or wud I be charged based on no. Of calls?
Or it's unlimited lol
b
Also I have mapped
console.log
to log to a database table and I put a realtime listener on it so I can debug in my browser console in real time. Pretty awesome.
I don't know how functions will be priced yet. Don't think that's been decided yet.
Depends on where it runs, I guess
h
Oh wow nice
b
But like I said, I'm doing everything in Postgres now -- even API calls.
h
I wanted to dynamically resize and cache images
b
I wrote a library called
supabase-mailer
and another called
supabase-sms
h
Dunno how long supabase will be this cheap for now they are a funded startup but they will raise prices sometime ig...
b
The first is an email library that sends emails through any of 5 major email services, and accepts data from webhooks to update the status of your message, so you know when it's been opened, or if links have been clicked, etc. Really sweet.
h
Supabase sms works with? Twilio or smthing like that or it's independent?
b
Prices don't necessarily have to go up, if we make money on the big players. That's how most of these companies work. Funded by big enterprise companies
I have it working with Twilio and one other provider so far, but will be adding more
h
Big players as in supabase users right ? But compared to firebase it's very cheap so idk is supabase even making money at all lol
b
sorry, I lied. I support 3 SMS providers
Twilio, SignalWire, Nexmo (now Vonage)
I don't know the money part of things -- I'm just a developer 🙂
h
I can't do this with postgres right? Lmao
b
I know we're not making money yet, but the model that most companies follow is that the successful users (think big enterprise customers) end up paying most of the bills
There is an image library extension for postgresql out there but I've never used it
So don't know how well it works
Personally I would do image processing on the client, which is cheaper and scales better. Then just have the server check for file sizes and such.
THere are tons of javascript image libraries to do this.
h
Well I just hope it stays this way
b
Well, the cool thing about Supabase is that you ALWAYS have the option to self-host, so we have to be competetive.
h
I do the same but if it's done in server it just has to be done once and it wud be faster download for client
b
I'd have the client process the image before uploading it. Then it's faster for the client, too.
if the client picks a huge image it takes a long time to upload, then your server takes a longer time to process it, slow for everyone
h
Not just one size tho I want different sizes
b
Client can do that pretty easily. But yes, this is one of the major use cases for functions.
for sure
But if you're looking to scale down the road, spend the time making it work on the client. Then you can get away with less server resources and your users will be happier.
h
Maybe I can just save two / three versions of the images
The main roadblock for me is real-time rls
Any workaround for this?
b
Not sure -- I don't know a ton about it. I use it, but not a lot.
What's your realtime use case?
there can be workarounds depending on what you're doing
h
Chat
b
move the data used by realtime to something that isn't as security-dependent
h
I use rls to make sure user can only see the messages of conversations they are part of
b
or use security through obscurity by using UUIDs or rolling keys of some sort
I'd have to think it through
h
It wud be nice if I can just add views into real-time
But probably not
b
If you create a chat dynamically, and make it a UUID, it would be hard for anyone to get access to that if they didn't know the UUID
h
No not dynamically
And there are places to search and join different conversations if they are public and open
So that won't be an issue
b
I'd have to think through the design but hopefully RLS will be available soon enough.
Inian or Copple might know more about that.
h
I was considering switching to firebase because of this lmao but i don't like that I have to pay on request basis for everything
b
That can be a nightmare
h
So am just sticking with supabase waiting
b
Thanks for you patience -- I believe it'll be worth it for you.
h
Yeah! Looks great so far
b
I'm loving it as a developer.
h
I am using Tailwind + svelte kit + supabase
It's almost perfect ❤️
But both
Sveltekit and supabase aren't production ready
b
depends on the application and use case... lots of people use it in production
but then again, lots of people use firebase in production too LOL
h
No firebase is in production
Supabase is in alpha or beta I think
Right?
b
That's just symantics
h
And sveltekit is in public beta as well
b
Supabase is really PostgreSQL, which is very, very mature.
h
Well it matters lmao so far I haven't run into issues but beta means we cant rule out issues
b
SO if you're using mostly database stuff, it's more than beta
h
Yeah true
b
Parts of it are beta, so it just depends on what you're using.
We're using Postgres, AWS, GoTrue, etc. lots of really mature code.
But certain things like realtime are new and beta
h
Why is trigger functions in alpha? It has been part of postgresql for a long time and I don't see anything supabase specific
b
It's not
What's alpha is the ability to edit and create triggers from the dashboard.
THe new dashboard GUI for triggers.
h
Omg ohh
b
If you write them in SQL editor, it's not alpha.
Just the dashboard tools are alpha / beta basically
h
Lmao
Aight
Does supabase automatically scale everything?
In free plan
b
Not in free plan
If you need to scale you should contact support and we'll help you plan and scale.
Been nice talking with you -- I have to run. It's getting late here. 🙂
h
Aight makes sense
Thank you for your time!