Interaction with dbs
1. Assuming you have a Function at
/functions/api/formSubmit
you should fetch /api/formSubmit
(notice the lack of the /functions
part)
2. a heads-up that regular databases are not compatible with Workers or Functions, you'd need to use a database that has an HTTP interface such as Supabase or the newly opened #d1-open-alpha3 Replies
Why are functions not compatible with regular databases? Is it because you cannot use adapters like prisma in workers due to cpu limitations? Can I use planetscale via their javascript driver?
It's because Workers can't make TCP connections. Planetscale's Javascript driver is HTTP so you're good and that will work
Basically Workers (and Functions) can only do HTTP, not TCP
(so no regular Postgres without Supabase which has HTTP)
or postgres without postgrest (what supabase uses under the hood)