惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Project Zero
Project Zero
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recorded Future
Recorded Future
B
Blog RSS Feed
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
D
DataBreaches.Net
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
NISL@THU
NISL@THU
T
Tailwind CSS Blog
博客园 - 【当耐特】
P
Privacy International News Feed
I
InfoQ
L
LINUX DO - 热门话题
H
Help Net Security
博客园 - 叶小钗
aimingoo的专栏
aimingoo的专栏
AWS News Blog
AWS News Blog
Scott Helme
Scott Helme
Cyberwarzone
Cyberwarzone
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Forbes - Security
Forbes - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
WordPress大学
WordPress大学
T
Troy Hunt's Blog
Spread Privacy
Spread Privacy
V
V2EX
Cloudbric
Cloudbric
Security Latest
Security Latest
H
Heimdal Security Blog
S
Securelist
I
Intezer
F
Full Disclosure
V2EX - 技术
V2EX - 技术
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
小众软件
小众软件
Security Archives - TechRepublic
Security Archives - TechRepublic
L
Lohrmann on Cybersecurity
S
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA

Supabase Blog

AI Agents Know About Supabase. They Don't Always Use It Right. Custom OIDC Providers for Supabase Auth 100,000 GitHub stars Supabase docs over SSH Navigating Regional Network Blocks Supabase Joins the Stripe Projects Developer Preview Log Drains: Now available on Pro Supabase Storage: major performance, security, and reliability updates Supabase incident on February 12, 2026 Hydra joins Supabase X / Twitter OAuth 2.0 is now available for Supabase Auth BKND joins Supabase Supabase is now an official Claude connector Supabase PrivateLink is now available Introducing: Postgres Best Practices When to use Read Replicas vs. bigger compute Introducing TRAE SOLO integration with Supabase Supabase Security Retro: 2025 Sync Stripe Data to Your Supabase Database in One Click Building ChatGPT Apps with Supabase Edge Functions and mcp-use Own Your Observability: Supabase Metrics API Introducing iceberg-js: A JavaScript Client for Apache Iceberg Introducing Supabase for Platforms Adding Async Streaming to Postgres Foreign Data Wrappers Build "Sign in with Your App" using Supabase Auth Introducing Seven New Email Templates for Supabase Auth The new Supabase power for Kiro Introducing Supabase ETL Introducing Analytics Buckets Introducing Vector Buckets Snap, Inc. Launches Snap Cloud, Powered by Supabase Triplit joins Supabase Supabase Series E 1000 Y Combinator Founders Choose Supabase gm 👋 web3, welcome aboard to Sign in with Web3 (Solana, Ethereum) Announcing the Supabase Remote MCP Server Enterprise speed, enterprise standards with Bolt Cloud + Supabase PostgREST 13 Lovable Cloud + Supabase: The Default Platform for AI Builders Processing large jobs with Edge Functions, Cron, and Queues Defense in Depth for MCP Servers OrioleDB Patent: now freely available to the Postgres community Supabase Launch Week 15 Hackathon Winner Announcement The Vibe Coder's Guide to Supabase Environments Testing for Vibe Coders: From Zero to Production Confidence The Vibe Coding Master Checklist Vibe Coding: Best Practices for Prompting Supabase Auth: Build vs. Buy Top 10 Launches of Launch Week 15 Supabase Launch Week 15 Hackathon Storage: 10x Larger Uploads, 3x Cheaper Cached Egress, and 2x Egress Quota Persistent Storage and 97% Faster Cold Starts for Edge Functions Algolia Connector for Supabase New Observability Features in Supabase Improved Security Controls and A New Home for Security Introducing Branching 2.0 Stripe-To-Postgres Sync Engine as standalone Library Supabase Analytics Buckets with Iceberg Support Create a Supabase backend using Figma Make Introducing JWT Signing Keys Supabase UI: Platform Kit Build a Personalized AI Assistant with Postgres Announcing Multigres: Vitess for Postgres Building on open table formats Open Data Standards: Postgres, OTel, and Iceberg Simplifying back-end complexity with Supabase Data APIs PostgreSQL Event Triggers without superuser access Top 10 Launches of Launch Week 14 Supabase MCP Server Data API Routes to Nearest Read Replica Declarative Schemas for Simpler Database Management Realtime: Broadcast from Database Keeping Tabs on What's New in Supabase Studio Edge Functions: Deploy from the Dashboard + Deno 2.1 Automatic Embeddings in Postgres Introducing the Supabase UI Library Supabase Auth: Bring Your Own Clerk Postgres Language Server: Initial Release Migrating from Fauna to Supabase Migrating from the MongoDB Data API to Supabase Dedicated Poolers Postgres as a Graph Database: (Ab)using pgRouting AI Hackathon at Y Combinator Calendars in Postgres using Foreign Data Wrappers Supabase Launch Week 13 Hackathon Winners How to Hack the Base! Running Durable Workflows in Postgres using DBOS database.build v2: Bring-your-own-LLM Restore to a New Project Hack the Base! with Supabase Top 10 Launches of Launch Week 13 Supabase Queues High Performance Disk Supabase Cron Supabase CLI v2: Config as Code Supabase Edge Functions: Introducing Background Tasks, Ephemeral Storage, and WebSockets Supabase AI Assistant v2 OrioleDB Public Alpha Executing Dynamic JavaScript Code on Supabase with Edge Functions ClickHouse Partnership, improved Postgres Replication, and Disk Management
Updates for Supabase Functions
Paul Copplestone · 2021-07-30 · via Supabase Blog

Updates for Supabase Functions

The question on everyone's mind - are we launching Supabase Functions? Well, it's complicated.

Today we're announcing part of Functions - Supabase Hooks - in Alpha, for all new projects.

We're also releasing support for Postgres Functions and Triggers in our Dashboard, and some timelines for the rest of Supabase Functions. Let's cover the features we're launching today before the item that everyone is waiting for: Supabase Functions.

PostgreSQL Functions#

(Not to be confused with Supabase Functions!)

Postgres has built-in support for SQL functions. Today we're making it even easier for developers to build PostgreSQL Functions by releasing a native Functions editor. Soon we'll release some handy templates!

You can call PostgreSQL Functions with supabase-js using your project API [Docs]:


_10

const { data, error } = await supabase.rpc('best_star_wars_series', {

_10

name: 'The Prequels',

_10

})


PostgreSQL Triggers#

Triggers are another amazing feature of Postgres, which allows you to execute any SQL code after inserting, updating, or deleting data.

While triggers are a staple of Database Administrators, they can be a bit complex and hard to use. We plan to change that with a simple interface for building and managing PostgreSQL triggers.

They say building a startup is like jumping off a cliff and assembling the plane on the way down. At Supabase it's more like assembling a 747 since, although we're still in Beta, thousands of companies depend on us to power their apps and websites.

For the past few months we've been designing Supabase Functions based on our customer feedback.

BYO Functions, zero lock-in#

A recurring request from our customers is the ability to trigger their existing Functions. This is especially true for our Enterprise customers, but also Jamstack developers who develop API Functions directly within their stack (like Next.js API routes, or Redwood Serverless Functions).

Timeline#

To meet these goals, we're releasing Supabase Functions in stages:

  • Stage 1: Give developers the ability to trigger external HTTP functions - today, using Database Webhooks.
  • Stage 2: Give developers the ability to trigger their own Serverless functions on AWS and GCP - Q4 2021.
  • Stage 3: Release our own Serverless Functions (Supabase Functions) - Q4 for Early Preview customers.

(Note: Database Webhooks were previously called "Function Hooks")

Today we're releasing Functions Hooks in ALPHA. The ALPHA tag means that it is NOT stable, but it's available for testing and feedback. The API will change, so do not use it for anything critical. You have been warned.

Hooks? Triggers? Firestore has the concept of Function Triggers, which are very cool. Supabase Hooks are the same concept, just with a different name. Postgres already has the concept of Triggers, and we thought this would be less confusing1.

Hook Events#

Database Webhooks allow you to "listen" to any change in your tables to trigger an asynchronous Function. You can hook into a few different events:INSERT, UPDATE, and DELETE. All events are fired after a database row is changed. Keen eyes will be able to spot the similarity to Postgres triggers, and that's because Database Webhooks are just a convenience wrapper around triggers.

Hook Targets#

Supabase will support several different targets.

  • HTTP/Webhooks: Send HTTP requests directly from your Postgres Database.
  • AWS Lambda/Google Cloud Run: Provide Supabase with a restricted IAM role to trigger Serverless functions natively.
  • Supabase Functions: We'll develop an end-to-end experience.

Hook Payload#

If the target is a Serverless function or an HTTP POST request, the payload is automatically generated from the underlying table data. The format matches Supabase Realtime, except in this case you don't a client to "listen" to the changes. This provides yet another mechanism for responding to database changes.


_21

type InsertPayload = {

_21

type: 'INSERT'

_21

table: string

_21

schema: string

_21

record: TableRecord<T>

_21

old_record: null

_21

}

_21

type UpdatePayload = {

_21

type: 'UPDATE'

_21

table: string

_21

schema: string

_21

record: TableRecord<T>

_21

old_record: TableRecord<T>

_21

}

_21

type DeletePayload = {

_21

type: 'DELETE'

_21

table: string

_21

schema: string

_21

record: null

_21

old_record: TableRecord<T>

_21

}


As with most of the Supabase platform, we leverage PostgreSQL's native functionality to implement Database Webhooks (previously called "Function Hooks").

To build hooks, we've released a new PostgreSQL Extension, pg_net, an asynchronous networking extension with an emphasis on scalability/throughput. In its initial (unstable) release we expose:

  • asynchronous HTTP GET requests.
  • asynchronous HTTP POST requests with a JSON payload.

The extension is (currently) capable of >300 requests per second and is the networking layer underpinning Database Webhooks. For a complete view of capabilities, check out the docs.

Usage#

pg_net allows you to make asynchronous HTTP requests directly within your SQL queries.


_11

-- Make a request

_11

select

_11

net.http_post(

_11

url:='https://httpbin.org/post',

_11

body:='{"hello": "world"}'::jsonb

_11

);

_11

_11

-- Immediately returns a response ID

_11

http_post

_11

---------

_11

1


After making a request, the extension will return an ID. You can use this ID to collect a response.


_14

-- Collect the response from a request

_14

select

_14

*

_14

from

_14

net.http_collect_response(1);

_14

_14

-- Results (1 row)

_14

status | message | response

_14

--------+---------+----------

_14

SUCCESS ok (

_14

status_code := 200,

_14

headers := '{"date": ...}',

_14

body := '{"args": ...}'

_14

)::net.http_response_result


You can cast the response to JSON within PostgreSQL:


_10

-- Collect the response json payload from a request

_10

select

_10

(response).body::json

_10

from

_10

net.http_collect_response(request_id:=1);


Result:


_20

{

_20

"args": {},

_20

"data": "{\"hello\": \"world\"}",

_20

"files": {},

_20

"form": {},

_20

"headers": {

_20

"Accept": "*/*",

_20

"Content-Length": "18",

_20

"Content-Type": "application/json",

_20

"Host": "httpbin.org",

_20

"User-Agent": "pg_net/0.1",

_20

"X-Amzn-Trace-Id": "Root=1-61031a5c-7e1afeae69bffa8614d8e48e"

_20

},

_20

"json": {

_20

"hello": "world"

_20

},

_20

"origin": "135.63.38.488",

_20

"url": "https://httpbin.org/post"

_20

}

_20

(1 row)


Implementation#

To build asynchronous behavior, we use a PostgreSQL background worker with a queue. This, coupled with the libcurl multi interface, enables us to do multiple simultaneous requests in the same background worker process.

Shout out to Paul Ramsey, who gave us the implementation idea in pgsql-http. While we originally hoped to add background workers to his extension, the implementation became too cumbersome and we decided to start with a clean slate. The advantage of being async can be seen by making some requests with both extensions:


_21

\timing on

_21

_21

-- using pgsql-http to fetch from "supabase.io" 10 times

_21

select

_21

*

_21

from

_21

http_get('https://supabase.com')

_21

cross join

_21

generate_series(1, 10) _;

_21

_21

-- Returns in 3.5 seconds

_21

Time: 3501.935 ms

_21

_21

-- using pg_net to fetch from "supabase.io" 10 times

_21

select

_21

net.http_get('https://supabase.com')

_21

from

_21

generate_series (1,10) _;

_21

_21

-- Returns in 1.5 milliseconds

_21

Time: 1.562 ms


Of course, the sync version waits until each request is completed to return the result, taking around 3.5 seconds for 10 requests; while the async version returns almost immediately in 1.5 milliseconds. This is really important for Supabase hooks, which run requests for every event fired from a SQL trigger - potentially thousands of requests per second.

Future/Roadmap#

This is only the beginning! First we'll thoroughly test it and make a stable release, then we expect to add support for

  • the remaining HTTP methods (PUT / PATCH)
  • synchronous HTTP
  • additional protocols e.g. SMTP, FTP
  • more throughput (using epoll)

Database Webhooks is enabled today on all new projects. Find it under Database > Alpha Preview > Database Webhooks.

  1. Postgres also has the concept of Hooks, but they're more of an internal concept. ↩