© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
4 replies
Tony_n

Documentation on stripe in edge function does not match implementation resulting in error.

I have reduced my edge function to just importing stripe and then creating the stripe client.

This throws an error in the edge function that says serve has already been declared.

import { serve } from "https://deno.land/std@0.131.0/http/server.ts";
import Stripe from "https://esm.sh/stripe?target=deno&no-check";
// import { getAccountLink } from '../shared/index.ts';

serve(async (req) => {
  const stripe = Stripe(Deno.env.get("STRIPE_API_KEY") ?? "", {
    // This is needed to use the Fetch API rather than relying on the Node http
    // package.
    httpClient: Stripe.createFetchHttpClient(),
    apiVersion: "2020-08-27",
  });
  // console.log(stripe)
  return new Response(
    JSON.stringify({ accountLink: 'https://google.com' }),
    { headers: { "Content-Type": "application/json" }, status: 200, statusText: 'OK' },
  )
})
import { serve } from "https://deno.land/std@0.131.0/http/server.ts";
import Stripe from "https://esm.sh/stripe?target=deno&no-check";
// import { getAccountLink } from '../shared/index.ts';

serve(async (req) => {
  const stripe = Stripe(Deno.env.get("STRIPE_API_KEY") ?? "", {
    // This is needed to use the Fetch API rather than relying on the Node http
    // package.
    httpClient: Stripe.createFetchHttpClient(),
    apiVersion: "2020-08-27",
  });
  // console.log(stripe)
  return new Response(
    JSON.stringify({ accountLink: 'https://google.com' }),
    { headers: { "Content-Type": "application/json" }, status: 200, statusText: 'OK' },
  )
})
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Edge function error for stripe connect
SupabaseSSupabase / help-and-questions
6mo ago
Stripe calls edge-function safely?
SupabaseSSupabase / help-and-questions
3mo ago
update openai edge function documentation
SupabaseSSupabase / help-and-questions
5mo ago
[SOLVED] Cannot import Stripe on Supabase Edge function
SupabaseSSupabase / help-and-questions
4y ago