Skip to content

Storage Upload Error Typescript Issue #1408

@FrancescaLiboni

Description

@FrancescaLiboni

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

The TypeScript type definition for StorageError is incorrect. The error object returned from storage operations (e.g., upload) contains a statusCode property, but the type definition specifies a status property. This mismatch causes type errors or requires unsafe type assertions when handling errors.

To Reproduce

Steps to reproduce the behavior:

  1. Use the Supabase JavaScript client (supabase-js) to perform a storage operation, such as uploading a file:
const { data, error } = await supabase.storage
     .from("files")
     .upload("path/to/file", file, { contentType: "application/pdf" });
  1. Make sure it returns an error and print it:
console.log(error)
// {"statusCode":"409","error":"Duplicate","message":"The resource already exists"}

Expected behavior

According to the type definition it should have returned: {"status":409,"error":"Duplicate","message":"The resource already exists"}

System information

  • OS: Ubuntu
  • Version of supabase-js: 2.49.4
  • Version of Node.js: 20.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    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