简体   繁体   中英

Firebase storage error "No object exists at the desired reference and no auth token for request"

i keep getting this error when i try to get the download URL for my files in my firebase storage, I don't know what the problem is anymore, I have tried a lot of things

    Exception has occurred.
FirebaseException ([firebase_storage/object-not-found] No object exists at the desired reference.)

W/StorageUtil(32618): no auth token for request
W/NetworkRequest(32618): no auth token for request
E/StorageException(32618): StorageException has occurred.
E/StorageException(32618): Object does not exist at location.
E/StorageException(32618):  Code: -13010 HttpResult: 404

here are my storage rules

service firebase.storage {
    match /{allPaths=**} {
      allow read;
    }
  }

here is my code

 return   GridView.builder(
                
    shrinkWrap: true,
  itemCount: snapshot.data.documents.length,
  gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
    crossAxisSpacing: 20, 
    mainAxisSpacing: 20,
    childAspectRatio: 1.7,
      crossAxisCount:2),
  itemBuilder: (BuildContext context, int index) {

    checkItems =  FirebaseFirestore.instance
        .collection('items');

checkItems = checkItems..where('id',isEqualTo: user_id.toString()); 

    DocumentSnapshot thesnapshot = snapshot.data.docs[index]; 


    
                                                              printUrl() async {
    Reference ref = 
        FirebaseStorage.instance.ref().child('antivirus.jpg');
       
       var togo = (await ref.getDownloadURL()).toString();
    setState(() {
      url =  togo;
    print('here is your url duuuuuuuuuuuuuuuuuuuuuudreeeeeeeeee'+url);
    });
    
}

printUrl()

.....................................................................................................................................

I had the same issue and i fixed removing the extension from the method, try like this:

 Reference ref = 
    FirebaseStorage.instance.ref().child('antivirus');

it worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM