storage
storage copied to clipboard
Response error object other than the expected StorageError is returned.
Bug report
Describe the bug
A non-StorageError response error object is returned.
To Reproduce
const { error } = await supabase.storage.from(BUCKET.ITEM).upload(path, image.file, {
upsert: true,
})
// expect: StorageError | null
// but returned error : {statusCode: '400', error: 'Invalid Input', message: 'The object name contains invalid characters'}
if (error instanceof StorageError) {
// Not Reachable...
console.log({ error })
}
- upload image file
- return validation error (Because it contains Japanese strings)
- Error response returns with no expectation(example:
{statusCode: '400', error: 'Invalid Input', message: 'The object name contains invalid characters'}
)
Expected behavior
Newly implement a response or expected response structure with a StorageError structure.
System information
- OS: macOS m2
- Browser chrome
- Version of "@supabase/supabase-js": "^2.2.3",
- Version of Node.js: v18.12.0
Duplicated with https://github.com/supabase/storage-api/issues/133
This is not a duplicate of #133 This ticket is about the typescript object StorageError. The response received in "error" contains different members than the definition of StorageError.
I.e. the "error" member of the received payload is missing in StorageError.
I am having the same issue. I try to upload a file called css.png and it says 'The object name contains invalid characters'. Not sure if it's my policies on my bucket, but css.png is definitely valid.
I'm having the same issue and it cripples my project as suddenly images are not uploaded.
I've the same problem as the original author described. I think the other comments are not related to the original issue, this is just a error type problem.
https://github.com/supabase/storage/blob/8fa98fab7716dccefb257b5fad8c3a9ba567df05/src/storage/object.ts#L50-L57
https://github.com/supabase/storage/blob/8fa98fab7716dccefb257b5fad8c3a9ba567df05/src/storage/limits.ts#L56-L66
https://github.com/supabase/storage/blob/8fa98fab7716dccefb257b5fad8c3a9ba567df05/src/storage/limits.ts#L33-L42