-
-
Notifications
You must be signed in to change notification settings - Fork 388
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- [ x ] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When using the 2.22.3 Python client, I'm finding the create_signed_upload_url doesn't have a base_url.
I traced it to when the storage object is created from the client, a base_url isn't being passed in to where the HTTP client is created. If options.http_client is None, which it is in my case,
self.session = http_client or AsyncClient(
headers=headers,
timeout=self.timeout,
proxy=proxy,
verify=self.verify,
follow_redirects=True,
http2=True,
)
This code will create an async client and it's not passing in base_url, so it's set as the empty string. This leaves the pre-signed URLs having no protocol/domain, etc.
To Reproduce
I'm running this in a local dev environment
This is my hack to get it to work:
async def generate_presigned_url(
storage_client: AsyncClient,
bucket: str,
storage_path: str,
) -> str:
"""Generate presigned URL for upload to Supabase storage."""
bucket_client = storage_client.storage.from_(bucket)
# For some reason, the base URL is not set correctly
# NOTE: Supabase bug?
if bucket_client._client.base_url == "":
bucket_client._client.base_url = f"{settings.supabase_url}/storage/v1/"
result = await storage_client.storage.from_(bucket).create_signed_upload_url(storage_path)
return result["signed_url"]
Expected behavior
The returned URL should have a protocol and domain.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
OSX, Python client, 2.22.3
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working