SUPABASE_URL is incorrect in edge function when developing locally #37271
Replies: 11 comments 6 replies
|
the value is hardcoded in the docker compose file: supabase/docker/docker-compose.yml Lines 38 to 39 in f4222eb |
|
Since opening this I've realized that the value returned for In my specific use case I needed the publicly facing URL for something else. I think a good resolution here would be to expose the |
|
@mark-monteiro looking at functions variables seems like the does not have the public url exposed, supabase/docker/docker-compose.yml Lines 315 to 338 in f4222eb
|
|
Okay, that makes sense. I'm not using a self-hosted setup with docker compose though, I'm using the supbase CLI with |
|
Hi guys, I'm going to move this over as a discussion, thanks for your help on this one. |
|
Hi all, any update on this? I'm facing the same issue — I'm using I'm using Supabase CLI for managing the local instance. There is no |
|
@aantti Quite an annoying problem with local self-hosting for development |
|
An alternative might be to define own variable in |
|
We're experiencing this issue trying to change edge functions over to the new middleware while developing locally. https://supabase.com/docs/guides/functions/auth Basically, I think JWT verification is getting tripped up because the internal url is not the same as the external url since it's just string comparison. kong:8000 = internal service URL inside Docker network 127.0.0.1:54321 = external/public URL you access from your laptop JWT iss must match the public issuer used when token is minted, so anything related to JWT validation should leverage 127.0.0.1 EIther way... adding a SB_JWT_ISSUER=http://127.0.0.1:54321/auth/v1 solves all of the issues, but I am wondering Is there something wrong with my setup or should I just use the public url when verifying JWT claims? |
|
As an update - added a note on internal vs external URLs here: https://supabase.com/docs/guides/self-hosting/self-hosted-functions#internal-vs-external-urls (as well as adding |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Describe the bug
When developing a supabase edge function locally, I am reading the built-in secret
SUPABASE_URLas documented here: https://supabase.com/docs/guides/functions/secrets#default-secrets.The value being returned is
http://kong:8000, which I assume is the address and port for internal docker networking. However, I would expect this value to be the valuehttp://127.0.0.1:54321, as returned fromsupabase status. This is the address the API can actually be accessed at.To Reproduce
SUPABASE_URL(console.log(Deno.env.get(SUPABASE_URL)))http://kong:8000Expected behavior
The value should be
http://127.0.0.1:54321Screenshots
If applicable, add screenshots to help explain your problem.
System information
Additional context
None
All reactions