mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
Fix supabase-js Deno compatibility by pinning to v2.45.0
The latest supabase-js@2.92.0 has a Deno compatibility bug with createRequire that causes all edge functions to fail with: "The argument 'filename' must be a file URL object..." Pin all edge functions to @2.45.0 with ?target=deno parameter to ensure Deno-compatible builds from esm.sh. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f88ee513d4
commit
6f1be7a4e1
21 files changed
+42
-25
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
import { decode } from "https://deno.land/std@0.208.0/encoding/base64.ts";
|
import { decode } from "https://deno.land/std@0.208.0/encoding/base64.ts";
|
||||||
import { unwrapWithAdminKey, base64ToUint8Array, KeysMetadata } from "../_shared/encryption.ts";
|
import { unwrapWithAdminKey, base64ToUint8Array, KeysMetadata } from "../_shared/encryption.ts";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
import { unwrapWithAdminKey, base64ToUint8Array, KeysMetadata } from "../_shared/encryption.ts";
|
import { unwrapWithAdminKey, base64ToUint8Array, KeysMetadata } from "../_shared/encryption.ts";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for streak milestones and send celebration notifications.
|
* Check for streak milestones and send celebration notifications.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
import { unwrapWithAdminKey, base64ToUint8Array, arrayBufferToBase64, KeysMetadata } from "../_shared/encryption.ts";
|
import { unwrapWithAdminKey, base64ToUint8Array, arrayBufferToBase64, KeysMetadata } from "../_shared/encryption.ts";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
import {
|
import {
|
||||||
unwrapWithAdminKey,
|
unwrapWithAdminKey,
|
||||||
base64ToUint8Array,
|
base64ToUint8Array,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process scheduled pack releases.
|
* Process scheduled pack releases.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send coalesced match notifications.
|
* Send coalesced match notifications.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send delayed pack change notifications.
|
* Send delayed pack change notifications.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send batched partner activity notifications.
|
* Send batched partner activity notifications.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
@@ -44,6 +44,15 @@ Deno.serve(async (req) => {
|
|||||||
console.log(`Checking subscription for user: ${user.id}`);
|
console.log(`Checking subscription for user: ${user.id}`);
|
||||||
console.log(`Using entitlement ID: ${ENTITLEMENT_ID}`);
|
console.log(`Using entitlement ID: ${ENTITLEMENT_ID}`);
|
||||||
console.log(`API key present: ${!!REVENUECAT_API_KEY}`);
|
console.log(`API key present: ${!!REVENUECAT_API_KEY}`);
|
||||||
|
console.log(`API key length: ${REVENUECAT_API_KEY?.length || 0}`);
|
||||||
|
|
||||||
|
if (!REVENUECAT_API_KEY) {
|
||||||
|
console.error("REVENUECAT_API_KEY is not set!");
|
||||||
|
return new Response(
|
||||||
|
JSON.stringify({ error: "Server configuration error: missing API key" }),
|
||||||
|
{ status: 500, headers: { ...corsHeaders, "Content-Type": "application/json" } }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch subscription status from RevenueCat API (server-side verification)
|
// Fetch subscription status from RevenueCat API (server-side verification)
|
||||||
const rcResponse = await fetch(
|
const rcResponse = await fetch(
|
||||||
@@ -60,9 +69,14 @@ Deno.serve(async (req) => {
|
|||||||
|
|
||||||
if (!rcResponse.ok) {
|
if (!rcResponse.ok) {
|
||||||
const errorText = await rcResponse.text();
|
const errorText = await rcResponse.text();
|
||||||
console.error("RevenueCat API error:", errorText);
|
console.error(`RevenueCat API error (${rcResponse.status}):`, errorText);
|
||||||
|
// Return the actual error details for debugging
|
||||||
return new Response(
|
return new Response(
|
||||||
JSON.stringify({ error: "Failed to verify subscription", details: errorText }),
|
JSON.stringify({
|
||||||
|
error: "Failed to verify subscription",
|
||||||
|
status: rcResponse.status,
|
||||||
|
details: errorText
|
||||||
|
}),
|
||||||
{ status: 500, headers: { ...corsHeaders, "Content-Type": "application/json" } }
|
{ status: 500, headers: { ...corsHeaders, "Content-Type": "application/json" } }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -79,8 +93,11 @@ Deno.serve(async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if entitlement is active
|
// Check if entitlement is active
|
||||||
const isActive = entitlement &&
|
// Note: expires_date can be null for lifetime subscriptions
|
||||||
new Date(entitlement.expires_date) > new Date();
|
const isActive = entitlement && (
|
||||||
|
entitlement.expires_date === null ||
|
||||||
|
new Date(entitlement.expires_date) > new Date()
|
||||||
|
);
|
||||||
|
|
||||||
console.log(`User ${user.id} subscription status: ${isActive ? "active" : "inactive"}`);
|
console.log(`User ${user.id} subscription status: ${isActive ? "active" : "inactive"}`);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
|
||||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
import { createClient } from "https://esm.sh/@supabase/supabase-js@2.45.0?target=deno";
|
||||||
|
|
||||||
const corsHeaders = {
|
const corsHeaders = {
|
||||||
"Access-Control-Allow-Origin": "*",
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
|||||||
Reference in new issue
Block a user