
Product
Redesigned Repositories Page: A Faster Way to Prioritize Security Risk
Our redesigned Repositories page adds alert severity, filtering, and tabs for faster triage and clearer insights across all your projects.
firebase-supabase-function-bridge
Advanced tools
Bridge between Firebase Functions and Supabase HTTP triggers.
This Node.js module lets Supabase securely call your Firebase Functions using HTTP triggers.
It also lets you automatically create Supabase HTTP triggers using your Firebase Functions.
npm i firebase-supabase-function-bridge
Then create your Firebase Function like you normally would except use our helper function. Under the covers this module creates a Firebase HTTP function for you that checks to see if Supabase really is calling it.
const {
createSupabaseFunction,
FunctionTypes,
} = require('firebase-supabase-function-bridge')
module.exports.myFunctionName = createSupabaseFunction(
'photos',
FunctionTypes.CREATE,
(req, res) => {
const myPhoto = req.body.record
res.status(200)
}
)
module.exports.myFunctionName = createSupabaseFunction(
'users',
FunctionTypes.UPDATE,
(req, res) => {
const oldProfile = req.body.old_record
const newProfile = req.body.record
console.log(
`You changed your username from "${oldProfile.username}" to "${newProfile.username}"`
)
res.status(200)
}
)
Your function can either return any value or a Promise
with a value and the module will return a 200 status code. Or you can send any status code using Express. If you do not do anything it will always send a 200.
Then add some additional Firebase Function config:
firebase functions:config:set supabase.url="YOUR SUPABASE APP URL" supabase.service_role_secret="YOUR SERVICE ROLE SECRET" supabase.custom_api_key="YOUR CUSTOM API KEY"
Then deploy your Firebase Functions using the Firebase CLI as normal.
To ensure only Supabase is calling your Firebase Functions we use a simple API key system. Set any string as your API key and this module will check if a x-api-key
header includes your key.
If you create your Firebase Functions using our helper function, our script can look at your functions and automatically create Supabase HTTP triggers for you (instead of doing it manually in the web console).
Note this will replace any existing triggers with the same names.
First set an environment variable so we can connect to your Postgres database:
POSTGRESQL_CONNECTION_URL=postgres://postgres:YOUR_PASSWORD@YOUR_DB_URL:5432/postgres
Then run the module and provide some details to configure your triggers:
firebase-supabase-function-bridge
--baseUrl=https://us-central1-my-project.cloudfunctions.net
--customApiKey=[YOUR CUSTOM API KEY]
--debug
Show extra output.
--functions=myFuncName,anotherFuncName
A comma delimited list of function names to deploy.
--initApp
Initialise Firebase Admin for you. This usually conflicts with your Firebase Functions code.
FAQs
Bridge between Firebase Functions and Supabase HTTP triggers.
The npm package firebase-supabase-function-bridge receives a total of 4 weekly downloads. As such, firebase-supabase-function-bridge popularity was classified as not popular.
We found that firebase-supabase-function-bridge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Our redesigned Repositories page adds alert severity, filtering, and tabs for faster triage and clearer insights across all your projects.
Security News
Slopsquatting is a new supply chain threat where AI-assisted code generators recommend hallucinated packages that attackers register and weaponize.
Security News
Multiple deserialization flaws in PyTorch Lightning could allow remote code execution when loading untrusted model files, affecting versions up to 2.4.0.