🔧 ProgrammierungThe Cascade Runs Ahead of the Flip(16.09.2026 um 02:21 Uhr)
🔧 ProgrammierungWeekly Dev Log 2026-W19(16.09.2026 um 02:30 Uhr)
🔧 ProgrammierungI wanted to remember what changed after an AI coding session(16.09.2026 um 02:34 Uhr)
🔧 ProgrammierungYour change process governs code. This was not code.(16.09.2026 um 02:39 Uhr)
🔧 ProgrammierungThe Cascade Runs Ahead of the Flip(16.09.2026 um 02:21 Uhr)
🔧 ProgrammierungWeekly Dev Log 2026-W19(16.09.2026 um 02:30 Uhr)
🔧 ProgrammierungI wanted to remember what changed after an AI coding session(16.09.2026 um 02:34 Uhr)
🔧 ProgrammierungYour change process governs code. This was not code.(16.09.2026 um 02:39 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 7 Min Lesezeit
0

Supabase Edge Functions: Introducing Background Tasks, Ephemeral Storage, and WebSockets

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

We are excited to announce three long-awaited features: Background Tasks, Ephemeral File Storage, and WebSockets.



.






Ephemeral Storage



Edge Function invocations now have access to ephemeral storage. This is useful for background tasks, as it allows you to read and write files in the /tmp directory to store intermediate results.



Check the guide on how to access , which uses WebSockets. This is tricky to implement purely client-side because you'd need to expose your OpenAI key publicly. OpenAI to authenticate users and protect your OpenAI usage from being abused.




CODE
import { createClient } from 'jsr:@supabase/supabase-js@2'

const supabase = createClient(
Deno.env.get('SUPABASE_URL'),
Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')
)
const OPENAI_API_KEY = Deno.env.get('OPENAI_API_KEY')

Deno.serve(async (req) => {
const upgrade = req.headers.get('upgrade') || ''

if (upgrade.toLowerCase() != 'websocket') {
return new Response("request isn't trying to upgrade to websocket.")
}

// WebSocket browser clients does not support sending custom headers.
// We have to use the URL query params to provide user's JWT.
// Please be aware query params may be logged in some logging systems.
const url = new URL(req.url)
const jwt = url.searchParams.get('jwt')
if (!jwt) {
console.error('Auth token not provided')
return new Response('Auth token not provided', { status: 403 })
}
const { error, data } = await supabase.auth.getUser(jwt)
if (error) {
console.error(error)
return new Response('Invalid token provided', { status: 403 })
}
if (!data.user) {
console.error('user is not authenticated')
return new Response('User is not authenticated', { status: 403 })
}

const { socket, response } = Deno.upgradeWebSocket(req)

socket.onopen = () => {
// initiate an outbound WebSocket connection to OpenAI
const url = 'wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-10-01'

// openai-insecure-api-key isn't a problem since this code runs in an Edge Function
const openaiWS = new WebSocket(url, [
'realtime',
`openai-insecure-api-key.${OPENAI_API_KEY}`,
'openai-beta.realtime-v1',
])

openaiWS.onopen = () => {
console.log('Connected to OpenAI server.')

socket.onmessage = (e) => {
console.log('socket message:', e.data)
// only send the message if openAI ws is open
if (openaiWS.readyState === 1) {
openaiWS.send(e.data)
} else {
socket.send(
JSON.stringify({
type: 'error',
msg: 'openAI connection not ready',
})
)
}
}
}

openaiWS.onmessage = (e) => {
console.log(e.data)
socket.send(e.data)
}

openaiWS.onerror = (e) => console.log('OpenAI error: ', e.message)
openaiWS.onclose = (e) => console.log('OpenAI session closed')
}

socket.onerror = (e) => console.log('socket errored:', e.message)
socket.onclose = () => console.log('socket closed')

return response // 101 (Switching Protocols)
})










Performance and stability



In the past few months, we have made many to Edge Functions. While these improvements often aren't visible to the end-users, they are the foundation of the new features we are announcing today.






What's next?



We have a very exciting roadmap planned for 2025. One of the main priorities is to provide customizable compute limits (memory, CPU, and execution duration). We will soon announce an update on it.



Stay tuned for the upcoming launches this week. You will see how all these upcoming pieces fit like Lego bricks to make your developer life easy.






More on LW13








Build stage



Vollständiger Original-Artikel
Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
AI networking startups race to replace Nvidia's NVLink
1 Quelle
The vulnpocalypse rains iBugs down on Apple with record-setting number of patches
1 Quelle
Wo Long 2: Wings of Ember feels like a blast from the past thanks to its fast, stylish, and satisfying action
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Supabase Edge Functions: Introducing Background Tasks, Ephemeral Storage, and WebSockets

Thematisch verwandte Begriffe: Supabase, Edge, Functions, Introducing · 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 ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...