Sorry everyone but I got a problem SERVICE
return this.storage.getFilePreview(
conf.appwriteBucketId,
fileId
)
}```
**Not working in my post form**
``` {post && (
<div className='w-full mb-4'>
<img
src={appwriteService.getFilePreview(post.blogImage)}
alt={post.title}
className='rounded-lg'
/>
</div>
)}```
**Not working in my Home page**
``` <div>
{!blogImage? null: <div>
<img src={appwriteService.getFilePreview(blogImage)} alt={title}/>
</div> }
<div'>
<div>{title}</div>
</div>
</div>```
**Not working in my blog page**(When I visit blog page it says missing parameter 'fileId')
```<img
src={appwriteService.getFilePreview(post.blogImage)}
alt={post.title}
className='rounded-xl'
/>```
This is where I assign fileId
try {
const file = await appwriteService.uploadFile(data.image[0]);
if (file) {
const fileId = file.$id
data.blogImage = fileId
console.log(`blogImage`, fileId)
const dbPost = await appwriteService.createPost({
...data,
userId: userData.$id})
if (dbPost) {
navigate('/profile')
}
}
} catch (error) {
console.log(`ERROR POSTING `, error)
}
}```
Please help
Did you try logging fileId before passing it into storage.getFilePreview()?
As with everything, troubleshoot by working your way back, making sure inputs/outputs/variables are what you expect them to be
Yes I did and it shows correct data
But you're getting an error saying fileId is missing?
react-router-dom.js?v=de89454e:3534 React Router caught the following error during render AppwriteException: Missing required parameter: "fileId" at Storage.getFilePreview (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=de89454e:2929:13) at AppwriteService.getFilePreview (http://localhost:5173/@fs/C:/Users/User/Desktop/bloghub/blogHub/src/backend/config.js?t=1711323347785:151:29) at Blog (http://localhost:5173/@fs/C:/Users/User/Desktop/bloghub/blogHub/src/pages/Blog.jsx?t=1711323347785:56:32) at renderWithHooks (http://localhost:5173/node_modules/.vite/deps/chunk-SHEUFWB5.js?v=de89454e:12171:26) at mountIndeterminateComponent (http://localhost:5173/node_modules/.vite/deps/chunk-SHEUFWB5.js?v=de89454e:14921:21) at beginWork (http://localhost:5173/node_modules/.vite/deps/chunk-SHEUFWB5.js?v=de89454e:15902:22) at beginWork$1 (http://localhost:5173/node_modules/.vite/deps/chunk-SHEUFWB5.js?v=de89454e:19749:22) at performUnitOfWork (http://localhost:5173/node_modules/.vite/deps/chunk-SHEUFWB5.js?v=de89454e:19194:20) at workLoopSync (http://localhost:5173/node_modules/.vite/deps/chunk-SHEUFWB5.js?v=de89454e:19133:13) at renderRootSync (http://localhost:5173/node_modules/.vite/deps/chunk-SHEUFWB5.js?v=de89454e:19112:15) Object
yes
Also, instead of saying something is not working, it's better to be explicit and say what is going on
sure
AppwriteException: Missing required parameter: "fileId"
In my home page I am not getting any error but I cannot preview the image same case with post form page but in my blog page it is showing that AppwriteException: Missing required parameter: "fileId"
Sounds like you have two different problems
yes
Focus on the file id error in this support thread
For your other one, search support for similar problems and 3rd party cookies
sure
Recommended threads
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- > AppwriteException: The requested servi...
When trying to read or write from my database I get the following error: > AppwriteException: The requested service is disabled. You can enable the service from...
- Courtesy limit reset for non-profit migr...
Hi Team! I'm the architect for a 501(c)(3) non-profit project (Aaria's Blue Elephant) and we just hit our Free plan Database Read limit (currently at 164%). Th...