-
-
Notifications
You must be signed in to change notification settings - Fork 260
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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/storage-js@0.0.0 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.
fenos and jhb-dev
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working