Open
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
I'm using a database trigger on the storage.objects table to sum up file sizes per bucket into a different table. When the quota is exceeded the database trigger raises an exception to not allow the upload:
RAISE EXCEPTION 'Storage quota for tenant exceeded' USING MESSAGE = 'Storage quota for tenant exceeded', DETAIL='Storage quota for tenant exceeded', HINT='Upgrade your plan';
I assumed the message of the exception would be passed on by the storage api but instead i receive:
{
message: 'Internal Server Error',
statusCode: '500',
error: 'internal'
}
The message from the database seems to be swallowed here for no apparent reason:
https://github.com/supabase/storage-api/blob/27c3b388a45be1fafdc51706be9c60349a9f5255/src/storage/database/knex.ts#L526-L556
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Create db trigger for objects table that raises exception
- try uploading a file
Expected behavior
If the SQL exception contains details, they whould be passed on like:
{
message: 'Storage quota exceeded',
statusCode: '500',
error: 'internal'
}
Could work similiar to here: supabase/auth#404
System information
- OS: ubuntu 22
- Browser (if applies): firefox
- Version of supabase-js: 2.22.0
- Version of Node.js: 16.20.1