Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Incorrect storage download link host in local #171

Description

@bombillazo

Describe the bug
Local edge functions run on docker inside a container called supabase_deno_relay which auto-sets the SUPABASE_URL. However, it uses the internal URL of the container network. This causes issues with the JS clients that run inside edge functions with storage since it creates the download and signed URLs using the internal http://supabase_kong_hyperion-app:8000 instead of the usual exposed localhost:54321api endpoint.

To Reproduce
Steps to reproduce the behavior:

  1. Run edge functions with serve cli command
  2. Generate a download link using the JS client inside an edge function
  3. Try to access the download link (will be in this format: http://supabase_kong_app:8000/storage/v1/object/public/public/users/ce5b2b2f-cfdc-4f56-a886-488dba35a184/file.txt) instead of using localhost:54321

Expected behavior
The download link generated is accessible locally using localhost:54321

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Version of CLI 1.75.2
  • Version of supabase-js 2.26.0

Activity

  1. sweatybridge commented on Jul 1, 2023

    @sweatybridge

    Yup this is a known limitation supabase/cli#1079 (comment). with a temporary workaround. I will leave this issue open for tracking.

  2. bombillazo commented on Jul 3, 2023

    @bombillazo
    ContributorAuthor

    Hey @sweatybridge , gotcha. How about if in the storage client, the download link functions check if the URL contains the internal edge function SUPABASE_URL (the kong url) used by the edge function and if it is, rewrite it to the localhost:54321 endpoint?

  3. sweatybridge commented on Jul 4, 2023

    @sweatybridge

    Perhaps a simpler alternative is to instantiate a separate StorageClient in your edge function with url set to localhost:54321. For example,

    import { StorageClient } from '@supabase/storage-js'
    
    const STORAGE_URL = 'http://localhost:54321/storage/v1'
    const SERVICE_KEY = '<service_role_key>'
    
    const storageClient = new StorageClient(STORAGE_URL, {
      apikey: SERVICE_KEY,
      Authorization: `Bearer ${SERVICE_KEY}`,
    })

    You can use this new client for creating signed urls and the original supabase-js client for other operations that target kong.

  4. bombillazo commented on Jul 5, 2023

    @bombillazo
    ContributorAuthor

    Hey @sweatybridge update: the suggested approach doesn't work, the URL has to be changed after the fact, if not the edge function client cannot find the API endpoint:

    Handler error: StorageUnknownError: error sending request for url (http://localhost:54321/object/sign/public): error trying to connect: tcp connect error: Cannot assign requested address (os error 99)
        at https://esm.sh/v127/@supabase/storage-js@2.5.1/esnext/storage-js.mjs:2:1638
        at Generator.next (<anonymous>)
        at u (https://esm.sh/v127/@supabase/storage-js@2.5.1/esnext/storage-js.mjs:2:1254)

    I think my original approach will work and will remove the need for developers to handle this edge case any time we use the storage client in local.

  5. sweatybridge commented on Jul 5, 2023

    @sweatybridge

    I see, thanks for investigating. Let me transfer this ticket to storage-js to see if anyone can pick it up sooner.

  6. transferred this issue fromsupabase/clion Jul 5, 2023
  7. mogaal commented on Jun 17, 2024

    @mogaal

    Any news with this? I'm facing same issue, all Signed URLs coming with "kong:8000". As a nasty workaround I created a function to search and replace for the real one but it is not ideal.

  8. alberto-abarzua commented on Jun 28, 2024

    @alberto-abarzua

    Any news with this? I'm facing same issue, all Signed URLs coming with "kong:8000". As a nasty workaround I created a function to search and replace for the real one but it is not ideal.

    Did the same workaround, storage API needs improvement!

  9. theconflictedfool commented on Jul 24, 2024

    @theconflictedfool

    Same issue over here, any updates?

  10. Ge6ben commented on Oct 25, 2024

    @Ge6ben

    Same here!!! even in getting the public URL!

    http://kong:8000/storage/v1/object/public/.......
    
    
  11. ManuelAngel99 commented on Oct 29, 2024

    @ManuelAngel99

    Same over here, I am using the official docker-compose and facing the same issue

  12. finallyclearsky commented on Dec 21, 2024

    @finallyclearsky

    +1, this is smelly 😄

  13. jrytio commented on Feb 9, 2025

    @jrytio

    Another vote for this issue.

  14. joshuacsg commented on Mar 17, 2025

    @joshuacsg

    Same here

  15. francescocretti commented on Apr 10, 2025

    @francescocretti

    +1

  16. Shardj commented on Apr 15, 2025

    @Shardj

    This has been causing me nightmares, do I need to start developing in production

  17. prinkeeras commented on May 25, 2025

    @prinkeeras

    what is with this kong issue... I'm just hard coding the URL in my edge function now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions