-
Hi, When a change occurs in my Supabase table, I'd like to trigger a function to update an Algolia index. In the Vercel documentation it mentions using Supabase for realtime data events (link). I see the subscribe option in Supabase, but not sure that is meant for this use case. Any thoughts on the best way to handle this? Alternatively I can setup a cron job to periodically sync, but I'd prefer the above solution if possible. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
We will launch Supabase functions during the last week of March which is perfect for this use case, so stay tuned! In the meantime, you could write a database function using If you want the index to be updated in realtime, you can use our client libraries to subscribe to changes and send it to Algolia as they arrive. This would require the script to be running continuously on a server somewhere (until we launch functions). |
Beta Was this translation helpful? Give feedback.
We will launch Supabase functions during the last week of March which is perfect for this use case, so stay tuned!
In the meantime, you could write a database function using
pg_cron
andpsql_http
which is installed in your Supabase DB to trigger the sync. I am assuming there is a way to update the Algolia index via a REST API call. Or a typical cron job as you mentioned would work too.If you want the index to be updated in realtime, you can use our client libraries to subscribe to changes and send it to Algolia as they arrive. This would require the script to be running continuously on a server somewhere (until we launch functions).