
const fileId = generateFileId(locationName);
const promise = storage.listFiles('6496afb137df9de6ce7b', fileId);
promise
.then((response) => {
console.log('Place images retrieved successfully:', response);
setPlaceImages(response.files);
})
.catch((error) => {
console.error('Failed to retrieve place images:', error);
// Handle the error
});
};
useEffect(() => {
retrievePlaceImages();
}, []);```

please help me remove the error

Failed to retrieve place images: AppwriteException: Server Error at Client.<anonymous>

Promise.then() dosen't returns response it goes straight away into catch block

You're using cloud?
Also, why not use async/try/await/catch rather than callbacks?


till now things were working i copy pasted from docs so

okay I am changing this to async/try/catch and if error persists i would let you know

hey steven error persists even after this


try {
const fileId = generateFileId(locationName);
console.log("retrievePlaceImages fileId: ", fileId);
const response = await storage.listFiles('6496afb137df9de6ce7b', fileId);
console.log('Place images retrieved successfully:', response);
setPlaceImages(response.files);
} catch (error) {
console.error('Failed to retrieve place images:', error);
// Handle the error
}
};
useEffect(() => {
retrievePlaceImages();
}, []);```

@Steven updated to try catch block

There are additional queries being passed 🧐

Perhaps you should be using get file instead

Or get file for view

my issue has got resolved with getFilePreview

Thanks Steven 😊

@Steven

ya there are

[SOLVED] How to use Storage Listfiles of appwrite
Recommended threads
- Subdomain failed verification
So I wanted to do a custom subdomain, because local storage doesn't work for me, but I've tried it a long time ago, it didn't work for me, and now I'm trying ag...
- [Node.js SDK] Bypass 2GB file limit?
Hello. Using either InputFile.fromPath or InputFile.fromBuffer throws this error: File size (2295467305) is greater than 2 GiB Bucket limit etc. is setup corre...
- Relationship null, even when relationshi...
Hi Everyone, im experiencing issues with set relation data. When im setting the document id from the related database most of them seem fine, except one table. ...
