Error on storage Search
Hi everyone, an error just happened in production 'randomly' because no changes have been done, but I now can't see the storage content in the app but also in the supabase dashboard:
It seems that a change have been done from
storage
to app_storage
.
I have tried to add back the search function, but anything I do tell me this:
ERROR: permission denied for schema app_storage (SQLSTATE 42501)
But I try to do it as the postgres
role...
Any idea on what to do or / and what is happening?41 Replies
Since I don't have
supabase_admin
role how could I add or change functions ?You should not be using any storage functions on your own and you should not change the one supabase has. IF you made changes a long time ago that are not not working because of a storage schema change, then only support can clean them up now.
Otherwise not sure what the issue is. What are you doing when you get the error?
Otherwise not sure what the issue is. What are you doing when you get the error?
Seems like it should have been added to your instance ages ago.
Not sure how it would have been deleted, so assume it was not installed on your instance.
They may have just started using it is why the sudden impact. It is on all of my recent instances. I would contact support.
They may have just started using it is why the sudden impact. It is on all of my recent instances. I would contact support.

I'm getting this error when from the studio dashboard going in any of the bucket in the storage tab
Understand. For some reason your instance does not have that function added.
Check here:

We have the functions added in the app_storage but not on the storage schema
I don't know what app_storage is.
I didn't know too before having the error


(thanks for replying by the way π)
That is not on any of my instances.
so weird, thanks anyway
I don't find the words "app_storage" in the storage github repository at all.
I don't know how you or an AI if you use would could move those as I thought storage is protected.
Support is still best bet.
This is Supabase hosted right?
Yes I have contacted the support, but I wait the answer for now, and yes it is hosted one, on the migrations on the local development instance there is not the app_storage schema neither. only on the hosted one which is even more confusing
I would like to hotfix by adding back the functions but since I don't have the rights it seems I can't..
That is correct. You can't modify the schema. Which is why I am puzzled how it occurred, unless it was many months ago when you could still change the schema and they just started using the function recently.
I assume you are using .list() in your app for it to be impacted?
Yes I'm using .list() exactly, but anyway it breaks also the dashboard UI since I cannot go in any of the buckets
I understand that.
You theoretically could replace .list with an rpc call to your own function that uses SQL to search and return info from storage.objects.
But it might be painful to write and test if you are doing searches and folders to a multiple levels.
No other reports of this and I don't find a hit on "app_storage" "supabase" on the web.
Yeah this would work as a hotfix you're right, I've search on reddit, github slack and yeah I didn't find anything neither.
I found in the migrations when started local development (with a
supabase db pull
command) but nothing on the app_storage
) .
And it looks like randomly today, the storage.search_v1_optimised
function have been removed from storage
schema, and now I cannot create it again.Yeah, no idea how it happened.
But as they locked all their schemas months back there is no way to add or move functions in them. I don't know if you upgraded your remote instance to the latest postgres if it would fix the storage schema or not as it keeps track of the migrations it has applied.
But as they locked all their schemas months back there is no way to add or move functions in them. I don't know if you upgraded your remote instance to the latest postgres if it would fix the storage schema or not as it keeps track of the migrations it has applied.
I didn't yet and I was hesitating to do it, because I had the same idea, but it stops the database for around an hour so I wanted to do it by night, not ideal right now, but I should give it a try tonight anyway.
(Thank you very much for all the replies again)
It seems I might wait the support answer to see what they can do on their side..
They can put them back as they are supabase_admin role.
Hi, did you find a solution? I'm having the same problem in my database
What is the same problem?
Do you have app_storage schema with the functions there?
When trying to access storage via supabase dashboard, i receive Failed to retrieve folder contents... storage.search_v1_optimised does not exist.
And yes i have an app_storage schema with that function (storage.search_1_optimised), but storage schema doesn't have it
What AI are both of you using if any?
Please file a support ticket and post it here.
I'm going to bump this.
Hey all, Bobbie from the Supabase team here. This is related to internal schemas restrictions which we've rolled out to existing projects recently.
Please file a support ticket if you're affected and we'll follow up with you there π
To clarify the confusions here:
- It seems you have an older version of
storage.search()
or it's been tampered somehow. Once you file a support ticket we can investigate further.
- app_storage
and app_auth
are created by us. The permission denied
error is unintended and we'll be fixing these. You'll be able to modify/drop these schemas if you need to.GitHub
Restricting Access on Auth, Storage, and Realtime Schemas on April ...
On April 21, we are restricting certain SQL actions you can perform in your databaseβs auth, storage, and realtime schemas. Why are we making these restrictions? Supabase Auth, Storage, and Realtim...
Some of the functions moved to the app_storage do seem to be ones that should have been in storage schema and are not there now. Like possibly the transfer including some Supabase functions. The function being called is in Supabase server source.
Errors are from .list() and UI storage panel.
Yep we had an allowlist of internal functions that won't get moved out of the internal schemas. But this is retrieved from the latest migrations - a project with up to date Storage migrations would have no
storage.search_v1_optimised()
and its storage.search()
would not call it. Safe to say our rollout was not foolproof.
Sorry Gary, should've sent a heads up to yall. Any similar issues with Auth and Storage please direct them to support tickets π
P.S. we've retrospectively fixed potentially affected projects, but please let us know if you're still seeing these.Ok, thanks for the reply, we just got even worst issue now...
In the logs we can find a lot of
schema "app_storage" does not exist
For the following query that is executed by supabase_admin
But now for every query we are doing to supabase we get this error:
Could not query the database for the schema cache. Retrying.
Not sure about the query,
But for the error restart your instance. Seems like postgREST has an issue. You could also check the PostgREST logs. Not sure how that would be related, but I don't know what was done by SB to "repair" storage.
You also probably need to update the ticket as no guarantee the Supabase dev is still looking at Discord and this thread.
thanks, I've just re-resent a ticket and also restarted the database to try. Thanks for replying to the thread again...
But all the app is down again π
You restarted DB or instance?
What call is getting that error?
And anything in the PostgREST logs (not Postres)?
Yeah I've just reloaded the instance:
and got this in PostgREST logs:
Check the API settings.
I think you or SB added that app_storage schema there and it needs to go away.

Your a crak bro
Dammn
You saved me
Amazing, thank you so much ππ
hi guys
my CPU usage started to reach the max and because of that my project started to have downtimes time to time... it turns out the issue was because of a storage query
select * from storage.search ($1, $2, $3, $4, $5, $6, $7, $8)
which seems to be the same as Damien
In the screenshot the problematic function has 94% of the time consumed, i tried increasing the compute size from Small to Large and that didnt solve the issue, Im still reaching 99.98% of CPU usage sometimes
did you also had this issue with the CPU usage @Damien ?
in this cases i query the storage

@bobbie tables help, please