ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseโ€ข4mo agoโ€ข
5 replies
skamz

Can't use createClient in Edge Function (can't find tslib)

Below is my code. I have confirmed that the env vars are set. The error is specifically coming from the
createClient
createClient
line .. when I comment it out, there's no error.

The specific error is this:
event loop error: Error: Cannot find module 'tslib' Require stack: - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/functions-js/2.76.0/dist/main/FunctionsClient.js - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/functions-js/2.76.0/dist/main/index.js - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/supabase-js/2.76.0/dist/main/SupabaseClient.js - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/supabase-js/2.76.0/dist/main/index.js - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/supabase-js/2.76.0/dist/main/index.js at Function.Module._resolveFilename (node:module:619:15) at Function.Module._load (node:module:497:27) at Module.require (node:module:681:19) at require (node:module:818:16) at Object.<anonymous> (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/functions-js/2.76.0/dist/main/FunctionsClient.js:4:17) at Object.<anonymous> (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/functions-js/2.76.0/dist/main/FunctionsClient.js:132:4) at Module._compile (node:module:745:34) at loadMaybeCjs (node:module:770:10) at Object.Module._extensions..js (node:module:755:12) at Module.load (node:module:662:32)
event loop error: Error: Cannot find module 'tslib' Require stack: - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/functions-js/2.76.0/dist/main/FunctionsClient.js - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/functions-js/2.76.0/dist/main/index.js - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/supabase-js/2.76.0/dist/main/SupabaseClient.js - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/supabase-js/2.76.0/dist/main/index.js - /var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/supabase-js/2.76.0/dist/main/index.js at Function.Module._resolveFilename (node:module:619:15) at Function.Module._load (node:module:497:27) at Module.require (node:module:681:19) at require (node:module:818:16) at Object.<anonymous> (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/functions-js/2.76.0/dist/main/FunctionsClient.js:4:17) at Object.<anonymous> (file:///var/tmp/sb-compile-edge-runtime/node_modules/localhost/@supabase/functions-js/2.76.0/dist/main/FunctionsClient.js:132:4) at Module._compile (node:module:745:34) at loadMaybeCjs (node:module:770:10) at Object.Module._extensions..js (node:module:755:12) at Module.load (node:module:662:32)


And here is the code

import { createClient } from 'npm:@supabase/supabase-js@2';

Deno.serve(async (req)=>{
  const supabaseAdmin = createClient(
    Deno.env.get('SUPABASE_URL') ?? '', Deno.env.get('SUPABASE_SERVICE_ROLE_KEY') ?? ''
  );

  return new Response(JSON.stringify("it works"), {
    status: 200,
    headers: {
      'Content-Type': "application/json",
      'Connection': 'keep-alive'
    }
  });
});
import { createClient } from 'npm:@supabase/supabase-js@2';

Deno.serve(async (req)=>{
  const supabaseAdmin = createClient(
    Deno.env.get('SUPABASE_URL') ?? '', Deno.env.get('SUPABASE_SERVICE_ROLE_KEY') ?? ''
  );

  return new Response(JSON.stringify("it works"), {
    status: 200,
    headers: {
      'Content-Type': "application/json",
      'Connection': 'keep-alive'
    }
  });
});
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Serving Edge Functions locally, can't find database function
SupabaseSSupabase / help-and-questions
3y ago
can't view Edge Function
SupabaseSSupabase / help-and-questions
6mo ago
Auth.getUser() can not find user in edge function
SupabaseSSupabase / help-and-questions
13mo ago
Can't upload supabase edge function
SupabaseSSupabase / help-and-questions
5w ago