Skip to content

Mutable reference options.headers #1095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
AsahiSoftWareEngineer opened this issue Apr 2, 2025 · 3 comments
Open
2 tasks done

Mutable reference options.headers #1095

AsahiSoftWareEngineer opened this issue Apr 2, 2025 · 3 comments
Labels
bug Something isn't working python Pull requests that update Python code

Comments

@AsahiSoftWareEngineer
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

A clear and concise description of what the bug is.

Mutable reference options.headers

options.headers is updated in create_client directry. thats why, The headers may be changed unintentionally if it is shared ClientOptions` instance other position.

To Reproduce

Please execute below source code jupytor notebook.

from supabase import create_client
from supabase.lib.client_options import SyncClientOptions 
class settings:
    SUPABASE_URL = "https://***"
    SUPABASE_KEY = "***"
from supabase._sync.client import create_client, ClientOptions
from gotrue import SyncMemoryStorage

# Share same ClientOptions Instanc
shared_options = ClientOptions(storage=SyncMemoryStorage(), headers={"Custom-Header": "InitialValue"})

# Create client1
client1 = create_client(settings.SUPABASE_URL, settings.SUPABASE_KEY, options=shared_options)

# Create client2
client2 = create_client(settings.SUPABASE_URL, settings.SUPABASE_KEY, options=shared_options)

# Rewrite header client1
client1.options.headers["Custom-Header"] = "ModifiedValue"
client2.options.headers["Custom-Header"] = "ModifiedValue2"

# Check header client2
print(client1.options.headers["Custom-Header"])  # "ModifiedValue2" 

Expected behavior

...
print(client1.options.headers["Custom-Header"])
# -> "ModifiedValue" 

Screenshots

Image

System information

  • mac OS
  • chrome
  • Version of supabase-py: 2.15.0
  • Version of Python: 3.9.0

Additional context

@AsahiSoftWareEngineer AsahiSoftWareEngineer added the bug Something isn't working label Apr 2, 2025
@AsahiSoftWareEngineer
Copy link
Author

@AsahiSoftWareEngineer I am going to fix bugs

@grdsdev grdsdev added the python Pull requests that update Python code label Apr 4, 2025 — with Linear
@supabase supabase deleted a comment from brambhattabhishek Apr 9, 2025
@gayathriramanesh
Copy link

Hi @AsahiSoftWareEngineer Is this issue fixed?

@AsahiSoftWareEngineer
Copy link
Author

@gayathriramanesh Hi, I think that already fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

3 participants