© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•5mo ago•
48 replies
MyLizard

Connection works in mjs, not in edge function

I have a js connection setup to the database that works great for me when testing the script, but when I put it into an edge function it fails. The URL and Key are the same in both cases.

What does the function expect that's different from what you can pass in a .mjs script? I'm a javascript newb so there's probably some fundamental difference I'm not aware of.

The error is in the screenshot along with the connection script from both places (the one with "try" is from the edge function), and pasted here:

"TypeError: error sending request for url (http://127.0.0.1:54321/rest/v1/user_apps?id=eq.2&select=*): client error (Connect): tcp connect error: Connection refused (os error 111): Connection refused (os error 111)\n
at async mainFetch (ext:deno_fetch/26_fetch.js:191:12)\n
at async fetch (ext:deno_fetch/26_fetch.js:465:11)\n
at async postData (file:///var/tmp/sb-compile-edge-runtime/hexnode_app_search/index.ts:33:27)\n
at async Object.handler (file:///var/tmp/sb-compile-edge-runtime/hexnode_app_search/index.ts:74:22)\n
at async mapped (ext:runtime/http.js:231:18)"
supa5.png
supa6.png
supa7.png
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

edge function no longer works
SupabaseSSupabase / help-and-questions
7mo ago
Edge Function not deploying
SupabaseSSupabase / help-and-questions
3y ago
EarlyDrop in edge function
SupabaseSSupabase / help-and-questions
7mo ago
Connection Pool authentication fails from edge function
SupabaseSSupabase / help-and-questions
4y ago