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

bucket_id is missing in object/info payload #541

Closed
2 tasks done
Vinzent03 opened this issue Sep 3, 2024 · 1 comment · Fixed by #546
Closed
2 tasks done

bucket_id is missing in object/info payload #541

Vinzent03 opened this issue Sep 3, 2024 · 1 comment · Fixed by #546
Labels
bug Something isn't working

Comments

@Vinzent03
Copy link

Vinzent03 commented Sep 3, 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

The bucket_id field of the FileObjectV2 interface is null, although the type definition says it's always a non-null string.

export interface FileObjectV2 {
  id: string
  version: string
  name: string
  bucket_id: string
  updated_at: string
  created_at: string
  last_accessed_at: string
  size?: number
  cache_control?: string
  content_type?: string
  etag?: string
  last_modified?: string
  metadata?: Record<string, any>
}

To Reproduce

When adding a console.log to the get object info test, the bucketId field is missing.

    test('get object info', async () => {
      await storage.from(bucketName).upload(uploadPath, file)
      const res = await storage.from(bucketName).info(uploadPath)
      console.log(res.data) // Added my be

      expect(res.error).toBeNull()
      expect(res.data).toEqual(
        expect.objectContaining({
          id: expect.any(String),
          name: expect.any(String),
          createdAt: expect.any(String),
          cacheControl: expect.any(String),
          size: expect.any(Number),
          etag: expect.any(String),
          lastModified: expect.any(String),
          contentType: expect.any(String),
          metadata: {},
          version: expect.any(String),
        })
      )
    })

I'm wondering why the bucketId field is not checked in the test, though, since the other properties are.

> @supabase/[email protected] test:suite
> jest --runInBand

 PASS  test/storageFileApi.test.ts
  ● Console

    console.log
      {
        id: '9e03b848-92d1-4e1a-8b9a-1e95ba5d8158',
        name: 'testpath/file-1725379793397.jpg',
        version: '78de5e3f-bfe6-4ac4-a95d-3025f53844d9',
        size: 29526,
        contentType: 'text/plain;charset=UTF-8',
        cacheControl: 'max-age=3600',
        etag: '"740f5c4bb4f6f2f73c1a301fa455c747"',
        metadata: {},
        lastModified: '2024-09-03T16:09:53.400Z',
        createdAt: '2024-09-03T16:09:53.405Z'
      }

      at test/storageFileApi.test.ts:394:15

EDIT: I just noticed the same issue is with updatedAt, lastAccessedAt

Expected behavior

The bucketId field is not null.

System information

  • OS: [Arch Linux]
  • Version of storage-js: [latest main branch state]
  • Version of Node.js: [e.g. v20.15.1]

Additional context

I've noticed this, while trying to implement the info method for the Dart storage package. Dart is strongly typed so marking it as non-null, while being actually null throws an exception.

@Vinzent03
Copy link
Author

Vinzent03 commented Oct 2, 2024

@fenos When using the latest storage docker image v1.11.11 the issue still persists. And in case you've missed it. The same issue is with updatedAt and lastAccessedAt.

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

Successfully merging a pull request may close this issue.

1 participant