[Python] Unauthorized: new row violates row-level security policy - while uploading to...

Discussão em 'Python' iniciado por Stack, Junho 6, 2025.

  1. Stack

    Stack Membro Participativo

    I am working with a project which needs to use python to store the jpg file into supabase storage. But I am getting an error:


    Failed to upload file:
    b'{"statusCode":"403","error":"Unauthorized","message":"new row violates row-level security policy"}'
    ​

    I have set up the RLS policies in Supabase project and also given necessary permissions to Supabase Storage to upload files.

    Here is my code:

    file_path = r"C:\supabase projects\supabase auth 24-01-2024\uploads\test.jpg"
    file_name = "test.jpg"
    path_on_supastorage = "uploaded_files/test.jpg"
    content_type = "image/jpg"

    with open(file_path, 'rb') as file:
    response = supabase.storage.from_(bucket_name).upload(
    file=file,
    path=path_on_supastorage)

    # Check for successful upload
    if response is not None:
    print(f"Failed to upload file: {response.content}")
    else:
    print(f"File uploaded successfully: {response}")



    What is the cause of this problem exactly?

    Continue reading...

Compartilhe esta Página