Skip to content

Downloading file from supabase-js returns empty response #189

@kylerummens

Description

@kylerummens

Bug report

Describe the bug

If I try to download a document in a public bucket from the supabase dashboard, it downloads correctly. But if I try to download the same document from my app using supabase-js, the response content is empty.

Like I mentioned, the bucket is public, so RLS shouldn't be an issue. Also I've verified that the file path is correct, given that it isn't throwing a "not found" error.

This only occurs with certain documents. I haven't identified any pattern, but I have verified that every document that gets returned as empty downloads correctly in the dashboard.

To Reproduce

const { data, error } = await this.supabase
    .client
    .storage
    .from(public_bucket)
    .download(file_path)

if (data) {
    // `data` object console logs to `Blob {size: 0, type: 'text/plain'}
    console.log(data);
    console.log(error);

    // File-saver-js
    saveAs(data, file_name);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    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