mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 03:32:22 +08:00
Merge branch 'main' of https://github.com/mendableai/firecrawl
This commit is contained in:
commit
705f5ebe78
|
@ -3,15 +3,17 @@ import { supabase_service } from "./supabase";
|
||||||
export const callWebhook = async (teamId: string, data: any) => {
|
export const callWebhook = async (teamId: string, data: any) => {
|
||||||
try {
|
try {
|
||||||
const selfHostedUrl = process.env.SELF_HOSTED_WEBHOOK_URL;
|
const selfHostedUrl = process.env.SELF_HOSTED_WEBHOOK_URL;
|
||||||
|
const useDbAuthentication = process.env.USE_DB_AUTHENTICATION === 'true';
|
||||||
let webhookUrl = selfHostedUrl;
|
let webhookUrl = selfHostedUrl;
|
||||||
|
|
||||||
if (!selfHostedUrl) {
|
// Only fetch the webhook URL from the database if the self-hosted webhook URL is not set
|
||||||
|
// and the USE_DB_AUTHENTICATION environment variable is set to true
|
||||||
|
if (!selfHostedUrl && useDbAuthentication) {
|
||||||
const { data: webhooksData, error } = await supabase_service
|
const { data: webhooksData, error } = await supabase_service
|
||||||
.from("webhooks")
|
.from("webhooks")
|
||||||
.select("url")
|
.select("url")
|
||||||
.eq("team_id", teamId)
|
.eq("team_id", teamId)
|
||||||
.limit(1);
|
.limit(1);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(
|
console.error(
|
||||||
`Error fetching webhook URL for team ID: ${teamId}`,
|
`Error fetching webhook URL for team ID: ${teamId}`,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user