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
- Update row sheet not loading
After right clicking a row header and click update, the sidebar fails to load (never-ending skeleton)
- Domain is already used. Please try again...
I have a website with where the www.domain.me This website works just fine But if I try to visit domain.me. I get this error. I keep getting sent to some app ri...
- Realtime api and labels as permission
in my tables i set labels as permission and real-time capabilities stopped working. Before when i was having "any" role everything was working. Note: user have...