1

I have previously been able to use firebase to store user images, but when once I created a new xcode project I've been getting this error:

Error Domain=FIRStorageErrorDomain Code=-13000 "An unknown error occurred, please 
 check the server response." UserInfo={object=WtLirPvwL9b7eI3zipGZkk1G4Hi2, 
ResponseBody={
  "error": {
    "code": 400,
    "message": "Permission denied. Please enable Firebase Storage for your bucket by 
    visiting the Storage tab in the Firebase Console and ensure that you have 
sufficient permission to properly provision resources."
}

I have been getting this error even after setting up storage for my project.

enter image description here

And I don't think it has to do with the usage rules--for one, I allowed unauthorized reads and writes, and in my testing, the user is already authorized before attempting to push images to storage. In fact, the uid generated from firebase's auth is what is being used as the reference. Also noteworthy is the fact that authorization with firebase is working fine--I'm having no errors creating accounts.

enter image description here

Another interesting fact--I also received this error after setting up yet another XCode project (and the corresponding steps in Firebase). So with two different Xcode projects, the same error is happening to me.

EDIT: usage rules and permissions

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth != null;
    }
  }
}

This is the default usage configuration. I previously had changed the content to allow read allow write to see if that would affect anything. But my error is happening with both that config and the default one.

Also, someone linked in the comments to a site recommending to check IAM and Admin permissions. As I suspected, I am the owner and so I see no permission problem there.

enter image description here

Additionally, nothing appears to be wrong with the GoogleService-Info.plist, even though that was what I suspected was wrong. Indeed, it includes the correct string for my storage bucket.

EDIT 2: CONSOLE ERROR

Thanks for @Leopold for pointing out that this error also occurs in the console. At first I thought that the console was working for me (I was able to upload images to it) but I now get the error when trying to view the image I uploaded through the console.

enter image description here

I got to this page by clicking on the image name hyperlink.

enter image description here

John Sorensen
  • 710
  • 6
  • 29
  • "Code 1300 Permission Error" 1300? It looks like you have three zeroes to me. – El Tomato Nov 20 '21 at 01:10
  • Do you have any ideas for a solution? – John Sorensen Nov 20 '21 at 01:15
  • And it's a negative number. – El Tomato Nov 20 '21 at 01:18
  • 1
    The error message may be a clue **Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources.** So it's possible you're rules are not set up correctly but we won't know becuase they were not included in the question. It's also possible the app was not added to the project and/or the *new* `GoogleService-Info` was not added to the project. Can you check those and update your question to clarify it? – Jay Nov 20 '21 at 14:29
  • please anyone find the solution about this issue i got the same message – Dark Knight Nov 20 '21 at 14:53
  • I don’t think it’s the usage rules as I had a problem with them on an earlier project and fixed it… the Google Service Info is a good tip, though. I’ve downloaded multiple google service info plists, so it’s possible that they got mixed up. And that would explain why there’s an authorization error… – John Sorensen Nov 20 '21 at 17:36
  • Any update? I'm also facing this issue and found quite a few posts for this lately. – Vibhor Nov 20 '21 at 19:19
  • Not yet… although now I’m wondering if it even could be the google service plist, as wouldn’t that impair authorization as well? – John Sorensen Nov 20 '21 at 19:40
  • I meant permissions error on my earlier comment, auth is working fine—I.e I am able to create users – John Sorensen Nov 20 '21 at 19:42
  • Fixed for me by following this https://newbedev.com/firebase-storage-security-rules-400-error-issue-permission-denied-could-not-access-bucket-xxxxx-appspot-com – Vibhor Nov 20 '21 at 22:47
  • I am the owner of my project, so that site's help about allowing permission does not apply to me. – John Sorensen Nov 21 '21 at 01:09
  • Check [this question and answer](https://stackoverflow.com/questions/50292353/firebase-storage-security-rules-400-error-issue-permission-denied-could-not-ac) as well – Jay Nov 21 '21 at 15:48
  • Clearly my permissions should be set up correctly, as I’m the owner of the account (as shown in the updated post). But is it possible that something is going wrong on Xcode’s side? Could it not be recognizing me as me? Also keep in mind that Auth is working fine—I can create users. So the problem has to be storage specific – John Sorensen Nov 21 '21 at 16:05
  • 1
    I'd been having the same issue, but this answer finally solved it https://stackoverflow.com/a/70060240/17482951 – Pato Nov 22 '21 at 21:36
  • @Pato your link solved my problem! If you or the person who answered the question wants to put an answer on this question, I'll award the bounty. This will also help anyone else get help. – John Sorensen Nov 23 '21 at 01:03

2 Answers2

1

For me it looks, that Google Cloud Platform configured in the way, that you do not have permission storage bucket.

  1. Go to https://console.cloud.google.com
  2. Pick your project
  3. Navigate to Cloud Storage
  4. Go to Permissions tab
  5. Add permission. Add permission which suits your needs most.

For my storage I am allowing to access my storage for everyone. And for you to see and play for troubleshooting to do the same.

  1. In the permission tap ADD
  2. Add Storage Object Viewer
  3. Click save

enter image description here

Ramis
  • 13,985
  • 7
  • 81
  • 100
  • What worked for me was similar--it was outlined in this answer: https://stackoverflow.com/questions/70053761/how-to-resolve-firebase-image-upload-shows-permission-issues/70060240#70060240 – John Sorensen Nov 23 '21 at 19:03
  • I am glad that you solved your problem. – Ramis Nov 23 '21 at 19:22
0

Considering I don't find older questions about this Exact issue, and that the only ones are from yesterday, then I suspect it's a server/google side issue. So I went on firebase storage, uploaded a file through the console, and then I saw this on the right side, under the upload button:

Error Loading Thumbnail/Image (Erro Carregando Visualiação)

image

And then I clicked on the name link (Nome: Fachada.jpg)

and got this:

Permission denied. Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources.

{   "error": {
"code": 400,
"message": "Permission denied. Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and

ensure that you have sufficient permission to properly provision resources." } }

So even the console is yielding this error! It's server sided, you just have to wait, and I have never seen this happen before on Firebase(there is no google search result for this exact error, except for yesterday Saturday, November 20th 2021)

  • I am able to upload images through the console, btw. I have no doubt that you weren't able to, just wanted to clarify that not all instances of this error involve problems with the console. – John Sorensen Nov 21 '21 at 17:19
  • This info is appreciated but it doesn't appear to answer the question - the server having an issue isn't really an answer as we are not encountering it so it would be specific to your account. Have you reached out to [Firebase support](https://firebase.google.com/support) for clarification that it is in fact a server issue? – Jay Nov 22 '21 at 18:26
  • I take back my earlier comment--when I tried to view the image I uploaded through the console, I got back the same error as I did in my Xcode app. See my updated post. – John Sorensen Nov 22 '21 at 20:28
  • I'll reach out to firebase support – John Sorensen Nov 22 '21 at 20:33