adrianhajdin / social_media_app

Build a modern social app with a stunning UI with a native mobile feel, a special tech stack, an infinite scroll feature, and amazing performance using React JS, Appwrite, TypeScript, and more.
https://jsmastery.pro
1.06k stars 305 forks source link

AppwriteException: Document with the requested ID could not be found. api.ts:264 #36

Open akshaydhame2001 opened 5 months ago

akshaydhame2001 commented 5 months ago

►GET https://cloud.appwrite.io/v1/databases/6580fe3.../collections/6586 api.ts:254 534.../documents/undefined 404 (Not Found) AppwriteException: Document with the requested ID could not be found. api.ts:264 at Client. (http://localhost:5173/node modules/.vite/deps/appwrite.js? v=639e56a2:850:17) at Generator.next () at fulfilled (http://localhost: 5173/node modules/.vite/deps/appwrite.js?v=639e56a 2:488:24) Query data cannot be undefined. Please make sure to return a value console.js:213 other than undefined from your query function. Affected query key: ["getPostById", "undefined"]

I have trouble with the edit post in the social media app project. In the tutorial the data automatically got populated in editpost except the image but in my case it doesn't.

Errors: I'm getting an GET error 404 for appwrite document ID and also getting query 'getPostById' to undefined

So in api.ts getPostById I checked that it's returning databaseID and postCollectionID from appwriteconfig but not the postId and that's why the post.

But I don't know why

Please help

UMDhodi commented 5 months ago

did you find solution ?

Jack-Jackk commented 1 month ago

Make sure in your PostCard.tsx the <Link to={/update-posts/${post.$id}} is correct as well as the link to /posts