Install Edge Worker
Let’s set up a few things before working with Edge Worker. This setup needs to be done only once per project.
-
Install Edge Worker
Section titled “Install Edge Worker”You can install Edge Worker using the pgflow installer (recommended) or manually if you want more control over the process.
Run the pgflow installer with npx:
npx pgflow@latest installThe installer will:
- Detect your Supabase project automatically
- Update your
config.toml
to enable connection pooling - Copy the required migrations to your migrations folder (including all Edge Worker tables)
- Create a functions environment file if needed
Then apply the migrations:
npx supabase migrations up -
Restart Supabase
Section titled “Restart Supabase”To ensure all the configuration changes are applied, restart Supabase:
npx supabase stopnpx supabase start
What was installed?
Section titled “What was installed?”The pgflow installer set up everything needed for Edge Worker:
- Database schemas - Required tables for worker management and message queuing
- Connection pooling - Configured in transaction mode for proper worker operation
- Environment variables - Database connection for Edge Functions
- Edge runtime policy - Set to per_worker mode for background tasks
That’s it! You’re ready to create your first worker and start processing messages 🥳