Skip to content

storage_client 2.5.0: _transformStorageUrl breaks projects without dedicated storage host #1328

Description

@heyuforia

Bug report

Describe the bug

storage_client 2.5.0 introduced _transformStorageUrl() in SupabaseStorageClient which unconditionally rewrites storage URLs:

https://<project-ref>.supabase.co/storage/v1
→ https://<project-ref>.storage.supabase.co/v1

The dedicated storage host (*.storage.supabase.co) is not available on all projects. For projects where it isn't enabled, every storage API call fails with StorageException: Invalid Storage request.

This silently breaks createSignedUrl, createSignedUrls, upload, download, and all other storage operations.

To Reproduce

  1. Have a Supabase project where <project-ref>.storage.supabase.co returns 404
  2. Upgrade to storage_client 2.5.0 (via supabase_flutter ^2.3.4 + flutter pub upgrade)
  3. Call supabase.storage.from('any-bucket').createSignedUrl('any/path.jpg', 3600)
  4. Get StorageException: Invalid Storage request

Expected behavior

The URL transformation should either:

  • Check if the dedicated host is available before rewriting (e.g., HEAD request or feature flag)
  • Fall back to the legacy URL if the dedicated host returns an error
  • Not be applied by default — let projects opt in

Evidence

Verified the dedicated host doesn't exist for our project:

  • https://<ref>.storage.supabase.co/v1/object/list/posts404
  • https://<ref>.supabase.co/storage/v1/object/list/posts400 (alive, needs auth)

Root cause

storage_client.dart lines 58-85:

static String _transformStorageUrl(String url) {
  // Unconditionally rewrites to *.storage.supabase.co
  // No availability check, no fallback
}

Workaround

Pin storage_client to 2.4.0 in pubspec.yaml:

dependency_overrides:
  storage_client: 2.4.0

Version

  • supabase_flutter: 2.12.1
  • storage_client: 2.5.0
  • supabase: 2.10.3
  • Flutter 3.41.5 / Dart 3.11.1

Platform

Android (also affects iOS — any platform using storage_client 2.5.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions