Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT NachrichtenTelekom: Neuer Reise-eSIM-Dienst T-Travel startet weltweit(21.09.2026 um 11:45 Uhr)
IT NachrichtenSamsung Wallet: Neue Banken mit an Bord(21.09.2026 um 13:07 Uhr)
IT NachrichtenTelekom: Neuer Reise-eSIM-Dienst T-Travel startet weltweit(21.09.2026 um 11:45 Uhr)
IT NachrichtenSamsung Wallet: Neue Banken mit an Bord(21.09.2026 um 13:07 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Supabase Edge Functions

Step-by-Step Guide to Using Edge Functions in Supabase and Scheduling Them with Cron Jobs Edge Functions in Supabase allow you to deploy server-side logic that runs on the edge, enabling fast and scalable operations. Here’s how you can c…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Step-by-Step Guide to Using Edge Functions in Supabase and Scheduling Them with Cron Jobs

Edge Functions in Supabase allow you to deploy server-side logic that runs on the edge, enabling fast and scalable operations. Here’s how you can create and deploy edge functions and schedule them with cron jobs:



1- Install Supabase CLI:



Download and install the Supabase CLI. This will be used to manage your project and deploy edge functions.

Install via npm:

npm install -g supabase



Authenticate with Supabase:

supabase login



Initialize a Supabase Project Locally:



Navigate to your project directory in the terminal.

Run:

supabase init



2. Create an Edge Function

Generate a New Function:



Use the CLI to generate a new edge function:



supabase functions new my-function

Replace my-function with the name of your function.

Write Your Function Logic:



Navigate to the functions/my-function/index.ts file.

Add your logic, for example:

javascript

`import { serve } from 'https://deno.land/[email protected]/http/server.ts';



serve(async (req) => {

return new Response('Hello, world!', {

headers: { 'Content-Type': 'text/plain' },

});

});`

Test Locally:



Start the function locally:

supabase functions serve my-function

Access the function at http://localhost:54321/functions/v1/my-function.

Deploy the Function:



Deploy your function to Supabase:

supabase functions deploy my-function

For this you must have Docker installed, and it must be open!




  1. Test the Deployed Function
    Get the Function URL:



In the Supabase dashboard, navigate to Functions > my-function.

Copy the deployed function's URL.

Call the Function:



Use tools like curl, Postman, or JavaScript fetch to test the deployed function:

curl https://your-project-id.supabase.co/functions/v1/my-function



4. Schedule the Function with Cron Jobs

Install and Enable pg_cron in Supabase

Access Your Supabase Project:



Log in to your Supabase dashboard and open your project.

Enable pg_cron Extension:



Go to Database > Extensions.

Search for pg_cron and enable it by clicking the toggle.

Verify Installation:



Open the SQL Editor and run:

SELECT * FROM pg_available_extensions WHERE name = 'pg_cron';



Add a Postgres Function to Call the Edge Function

You need to create a PostgreSQL function that calls your Supabase Edge Function using HTTP.



Create the Postgres Function:



In the SQL Editor, write and execute:



`CREATE OR REPLACE FUNCTION call_edge_function()

RETURNS void AS $$

DECLARE

response jsonb;

BEGIN

-- Make an HTTP request to the Edge Function

SELECT INTO response

http_post(

'https://your-project-id.supabase.co/functions/v1/my-function', -- Replace with your Edge Function URL

'{}', -- Optional JSON payload (adjust as needed)

'Authorization=Bearer your-anon-key; Content-Type=application/json' -- Replace with your Supabase anon key

);



-- Optionally log the response (for debugging)

RAISE NOTICE 'Response: %', response;

END;

$$ LANGUAGE plpgsql;`

Replace:



your-project-id with your Supabase project ID.

your-anon-key with your Supabase anon key (available in the dashboard under Settings > API).

Test the Postgres Function:



Call the function manually to ensure it works:



SELECT call_edge_function();

Check the output for any errors.




  1. Schedule the Function with pg_cron
    Create a Cron Job:



In the SQL Editor, write and execute:



SELECT cron.schedule(

'call_edge_function_job', -- Unique name for the job

'0 * * * *', -- Cron expression (e.g., every hour)

$$ SELECT call_edge_function(); $$

);


Replace the cron expression with your desired schedule. For example:



Every minute: * * * * *

Every hour: 0 * * * *

Every day at midnight: 0 0 * * *

List Scheduled Jobs:



Verify the job was created:

SELECT * FROM cron.job;

Remove or Update a Cron Job:



To remove a job:




SELECT cron.unschedule('call_edge_function_job');






By following these steps, you’ll have a fully functional edge function deployed on Supabase and scheduled with a cron job to run at your desired intervals.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Supabase Edge Functions

Thematisch verwandte Begriffe: Supabase, Edge, Functions · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94040 | A flaw has been found in vas3k TaxHacker up to 0.8.5. Affected by this v…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick