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
- delete document problems
i don't know what's going on but i get an attribute "tournamentid" not found in the collection when i try to delet the document... but this is just the document...
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here 🙂 I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...