-
Notifications
You must be signed in to change notification settings - Fork 11
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
listBuckets throws error #18
Comments
Having the same issue - everything related to storage returns |
It appears that some headers are not parsed correctly. The solution for me was to manually set them up. |
Hey Christophe, I am having a similar issue. I tried with the SupabaseStorageClient and SupabaseClient but no luck on my end. What did you pass in the headers ? and for which Supabase class ? |
You need to use var apiKey = "YOUR_API_KEY"
var url = "https://YOUR_URL.supabase.co/storage/v1"
let client = SupabaseStorageClient(url: url, headers: ["Authorization": "Bearer \(apiKey)", "apikey": apiKey]) Hope this helps! |
I am still getting no buckets returned, no way to create a bucket and also no way to upload anything after trying with The only thing that changed is that I do seem to be getting requests in the dashboard: |
Thanks I'm little bit closer now. I added |
Yea same, with the tips @ChristophePRAT mentioned it feels I'm getting closer. I have also tried to substitute the Bear token with the session token rather than the apikey but no luck. I've created another bucket with no policies and public and it can't find it. This is the closest I've been so far but very disappointed at the moment since I cannot do anything with storage :/ |
omg you are a legend! I can see my buckets finally |
Haha it was a group effort! By the way, I am currently working on a Supabase Swift series. Here is a link to it: https://www.youtube.com/playlist?list=PLWqniOnIerMYcqbMXAhdxAPDkGGNvpo7F It's a little tricky to find good resources on using Supabase in Swift, but I have I put together all the info I have been able to gather on there. |
Awesome - I'll check it out! I'm currently using it in 2 different projects. Did you manage to upload something? I get the error message: Message too long. It's a jpg picture so it shouldn't be an issue but not sure what's going on. |
Yes, I was able to upload sucessfully.
|
hey @ChristophePRAT and @nyeu, I noticed something interesting after implementing the Storage module. I have it successfully in my application, but when I try to sign out using the Supabase auth module, I get a new error. This goes away when I remove/comment any code thats using Supabase Storage. |
This is strange. I think there definitely is a problem with how the headers are set by default. I will try to have a look and do a PR this weekend. Thanks for the additional information and for the solution you provided! |
Please check usage on the integration test implementation at https://github.com/supabase-community/storage-swift/blob/main/Tests/SupabaseStorageTests/SupabaseStorageTests.swift There's a local instance of Supabase now on the repository (https://github.com/supabase-community/storage-swift/tree/main/supabase), please use it to test your implementation. For what I saw from this issue, I think its an issue with wrong RLS permissions, please make sure storage RLS is configured correctly and use the integration test and local supabase instance as an example. If the issue persists, please let me know. |
Hi folks! I have understood more clearly what problems we are facing.
Please let me know if I missed something. Thanks a lot for helping me figure it out! |
supabase/supabase-swift#87 got merged, can you please verify if it solves this issue? |
I have just tested it. Works fine now! |
Never use that key on front end code. I am able to upload from swiftui after setting my storage policy. Even tho the storage bucket is set to "public" you won't be able to upload without first setting the storage policy for inserting. I added ((bucket_id = 'images'::text) AND (auth.uid() = id)) to my policy. "images" being the name of my bucket. |
Thanks everyone!
This worked for me as well. However are you able to successfully sign out ? I still get this issue when signing out after using the storage section. |
yea I have no errors on sign out. I do see errors after logging in. It looks like some refresh token error since it comes up after a few seconds and will fill my console after awhile. I tried adding delete function and looks like I needed to set select and delete storage policies, but after that deleting the image before uploading works fine. Without the proper storage policies deleting did not throw any errors at all. I understand that supabase swift is still early in dev so I expect some errors. |
I tried this and it doesnt seem to work for me. I also tried using the authtoken from the session in the headers and no access Whenever I try to use my apikey the error returns to say invalid jwt. When I use the session token I get back a 400 error still but this time with no error message |
Bug report
Listing buckets crashes the app.
Describe the bug
When I try to use
.listBuckets()
as mentioned here, my app throws an error (caught usingfatalError
with the name "Error"). The error status code is 400.To Reproduce
try await client.storage.listBuckets()
System information
The text was updated successfully, but these errors were encountered: