
I am lost and have no idea how to fix this
I am trying to update a document with the server SDK in my NextJS applications
this is our // src/app/api/matches/updateMatch/route.ts
try { const { databases, account } = await createSessionClient( sessionCookie.value ); await databases.updateDocument( process.env.NEXT_PUBLIC_DATABASE_ID!, process.env.NEXT_PUBLIC_COLLECTION_MATCHES!, matchId, { [key]: value } );
this is the request
const response = await fetch(`/api/matches/setup`, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ key, value: validatedValue, matchId }),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
this is the error Compiled /api/matches/setup in 614ms (849 modules) Session Cookie: eyJpZCI6IjY3MGFkOT... Updating document with: { databaseId: '66------------d0', collectionId: 'matches', matchId: '6745ba27001606a4215b', data: { location: '6712a842000b8bc14916' } } API Error: AppwriteException: Server Error at async PATCH (src\app\api\matches\setup\route.ts:43:4)
41 | }); 42 |
43 | await databases.updateDocument( | ^ 44 | process.env.NEXT_PUBLIC_DATABASE_ID!, // databaseId 45 | process.env.NEXT_PUBLIC_COLLECTION_MATCHES!, // collectionId 46 | matchId, // documentId { code: 500, type: 'general_unknown', response: [Object] } PATCH /api/matches/setup 500 in 1981ms
all of the env variables are correct.
I am lost and don't know what to do next in trouble shooting.
any help would be appreciated

FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting).

Before throwing that http error, can you try logging the response body?
Recommended threads
- Doing the React TMDB movies tutorial, is...
At the point where I created a brand new app on appwrite but cannot instantiate the react platform without cloning a whole other app and doing some ping button ...
- ❗[Help] Function stuck in "waiting" stat...
Hi Appwrite team 👋 I'm trying to contribute to Appwrite and followed the official setup instructions from the CONTRIBUTING.md guide to run the platform locall...
- Help with 409 Error on Relationship Setu...
I ran into a 409 document_already_exists issue. with AppWrite so I tried to debug. Here's what I've set up: Collection A has 3 attributes and a two-way 1-to-m...
