Skip to content
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

data.id (still) missing for data return type / upload function #198

Open
2 tasks done
mikelieser opened this issue Apr 24, 2024 · 1 comment
Open
2 tasks done

data.id (still) missing for data return type / upload function #198

mikelieser opened this issue Apr 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mikelieser
Copy link

mikelieser commented Apr 24, 2024

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

I get a type error after uploading a file, as "id" is not defined in current version 2.5.5 return data type for the upload function.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  • use current supabase/storage-js version 2.5.5 and TypeScript.
  • use this code
const { data } = await supabase.storage
      .from("bucket_name")
      .upload(
        `filename`,
        fileData
      );
    if (data) {
      const fileId = data.id; // <<< Property 'id' does not exist on type '{ path: string; }'.ts(2339)
    }

Result: Property 'id' does not exist on type '{ path: string; }'.ts(2339)

Expected behavior

  • no type error while accessing .id as the type is correctly defined.

Screenshots

version 2.5.5 type definition

Bildschirmfoto 2024-04-24 um 10 41 02

v2.5.5 code (latest version)
https://github.com/supabase/storage-js/blob/v2.5.5/src/packages/StorageFileApi.ts#L141

main code:
https://github.com/supabase/storage-js/blob/main/src/packages/StorageFileApi.ts#L142

It looks like something did not work as planned as there are commits fixing the upload return type:
https://github.com/supabase/storage-js/commits/v2.5.5

in main the code is fine since this commit Dec 19 2023:
68a6197

So I guess you just need to release v2.5.6 to fix it again 😄 Thanks.

System information

  • OS: macOS 14.4.1
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: 2.42.5
  • Version of @supabase/storage-js: 2.5.5
  • Version of Node.js: 20.11.0

Additional context

Add any other context about the problem here.

@mikelieser mikelieser added the bug Something isn't working label Apr 24, 2024
@mikelieser
Copy link
Author

older issue: #170
PR fix in the past: #168

npm code v2.5.5: https://www.npmjs.com/package/@supabase/storage-js?activeTab=code

Bildschirmfoto 2024-04-24 um 10 59 07

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

No branches or pull requests

1 participant