© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
3 replies
Songle Jin

supabase cron & multi envs.

What is a good practice to handle .sql migration containing cron schedules? If the same migration have to be executed in multiple environments?

select
  cron.schedule(
    'function-schedule',
    '0 0 * * *',
    $$
    select
      net.http_post(
          url:='PROJECT_SPECIFIC_URL',
          headers:=jsonb_build_object('Content-Type','application/json', 'Authorization', 'Bearer ' || 'YOUR_ANON_KEY'),
          body:=jsonb_build_object('time', now() ),
          timeout_milliseconds:=5000
      ) as request_id;
    $$
  );
select
  cron.schedule(
    'function-schedule',
    '0 0 * * *',
    $$
    select
      net.http_post(
          url:='PROJECT_SPECIFIC_URL',
          headers:=jsonb_build_object('Content-Type','application/json', 'Authorization', 'Bearer ' || 'YOUR_ANON_KEY'),
          body:=jsonb_build_object('time', now() ),
          timeout_milliseconds:=5000
      ) as request_id;
    $$
  );


What is the best way to inject the correct values?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Managing envs in local supabase development
SupabaseSSupabase / help-and-questions
4mo ago
Increase Supabase CRON Timeout
SupabaseSSupabase / help-and-questions
4mo ago
[URGENT] supabase queue + cron
SupabaseSSupabase / help-and-questions
4mo ago
supabase db reset: problems with pg_cron
SupabaseSSupabase / help-and-questions
14mo ago