Combine Openai Embeddings and Supabase Vector Search in One Call
Parallel OpenAI fetch merged before Frontend / Web hydrates
Instead of Frontend / Web firing serial fetches to OpenAI and Supabase, one pipeline hits https://api.openai.com/v1/embeddings (and sibling steps) in parallel and returns mapped JSON.
Waterfall latency from multiple OpenAI and Supabase requests
Frontend / Web widgets often await OpenAI and Supabase sequentially, multiplying TLS handshakes on cellular networks and amplifying failure rates.
- Race conditions between parallel manual fetches
- Higher mobile data usage from redundant JSON
- Timeouts when any upstream exceeds cellular RTT
How RealComposer Solves This at the Edge
Add vault secrets for this pipeline
Create OPENAI_API_KEY, SUPABASE_SERVICE_ROLE_KEY vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.
Target the real upstream URL
Point step openai at https://api.openai.com/v1/embeddings with POST. Add output mapping fields that mirror the JSON contract your screen already expects. POST pipelines set cache TTL to 0 because RealComposer only stores GET responses at the edge.
Call from Frontend / Web
Call https://realcomposer.com/v1/workspace/combine-openai-and-supabase-vector-search with a restricted rc_live_ client token. Frontend / Web never sends upstream secrets.
const res = await fetch('https://realcomposer.com/v1/workspace/combine-openai-and-supabase-vector-search', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"requestId": "req_combine-",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "combine-openai-and-supabase-vector-search"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"openai_reply": "sample",
"openai_tokens": "sample",
"supabase_rowId": "sample",
"supabase_email": "sample"
}
Recipe Specs
- HTTP method
- POST
- Upstream calls
- 2
- Edge cache TTL
- No caching
- Client auth
- Restricted client token
- Mapped output fields
- 4
- Payload
- 260 B to 102 B (-61%)
curl -X POST "https://realcomposer.com/v1/workspace/combine-openai-and-supabase-vector-search" \
-H "Authorization: Bearer rc_live_client_token" \
-H "Content-Type: application/json" \
-d '{"model":"example"}'Developer Questions & Troubleshooting
Does Frontend / Web need CORS changes after adding RealComposer?
Yes for combine-openai-and-supabase-vector-search. Ship only an rc_live_ client token in Frontend / Web; RealComposer injects OPENAI_API_KEY on https://api.openai.com/v1/embeddings.
What cache key does RealComposer use?
combine-openai-and-supabase-vector-search forwards client JSON to POST upstreams unchanged; secrets interpolate only in URLs and header templates.
How do I rotate upstream credentials?
Upstream steps in combine-openai-and-supabase-vector-search honor timeoutMs and optional fallback JSON without leaking secrets.
Sources & Definitions Used in This Answer
Deploy this Frontend / Web + OpenAI, Supabase Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.