Skip to content
Back

Error getDocument: request cannot have request body

  • 0
  • Functions
  • Web
  • Cloud
Horsty - Cyril - MagicTools
15 Apr, 2025, 17:40

I don't understand why is the meaning of this error

In my Appwrite function, when i execute it, i get this error in my try/catch request cannot have request body any idea of the root cause ?

TypeScript
    log(`I get this: ${payload.tournamentId}`); // show the expected id

    const tournament = await databases.getDocument(
      process.env.APPWRITE_DATABASE_ID, // < it's setup in the settings sections
      "tournaments",
      payload.tournamentId // < it's exist in my collection "tournaments"
    );
// 🔥 Crash here     "responseBody": "{\"success\":false,\"message\":\"request cannot have request body\"}",

    log(`I didn't get this: ${tournament}`); 

I'm using appwrite cloud

TL;DR
Developers encountering `request cannot have request body` error in the Appwrite Python SDK should update to `node-appwrite: "^15.0.1"`. The issue was fixed in the newer version, resolving discrepancies with network changes in cloud settings. The error was due to a body being included in a GET request, which is now resolved in the updated SDK version.
John
15 Apr, 2025, 19:55

and still very odd that you're seeing this inconsistently

John
15 Apr, 2025, 19:56

I'm self hosting and not on cloud, so I don't think I can help with this. Sorry!

Horsty - Cyril - MagicTools
15 Apr, 2025, 19:56

i have try to create another function with another id / name to be sure i have no cash issue

Horsty - Cyril - MagicTools
15 Apr, 2025, 19:56

cache*

Horsty - Cyril - MagicTools
15 Apr, 2025, 19:57

i try to debug it by doing lot of strange stuff

Horsty - Cyril - MagicTools
15 Apr, 2025, 20:25
TypeScript
Error: request cannot have request body
    at Client.call (/usr/local/server/src/function/node_modules/node-appwrite/lib/client.js:170:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Databases.getDocument (/usr/local/server/src/function/node_modules/node-appwrite/lib/services/databases.js:1704:16)
    at async Module.default (file:///usr/local/server/src/function/src/main.js:30:24)
    at async execute (/usr/local/server/src/server.js:208:16)
    at async action (/usr/local/server/src/server.js:225:7)
    at async /usr/local/server/src/server.js:14:5
John
15 Apr, 2025, 21:12

with those paths you're on the 12.0.1 SDK or earlier, I wonder if there's an incompatibility with the new network changes for cloud: https://appwrite.io/docs/products/network

John
15 Apr, 2025, 21:13

here's the call code, you can see where it's not setting a body on a get request but the header is still included: https://github.com/appwrite/sdk-for-node/blob/12.0.1/lib/client.js#L154

Horsty - Cyril - MagicTools
15 Apr, 2025, 21:22

I have update all package.json to update version

Horsty - Cyril - MagicTools
15 Apr, 2025, 21:22

and yes, i'ts fix the error

John
15 Apr, 2025, 21:26

interesting! Which version did you bump up to?

Horsty - Cyril - MagicTools
15 Apr, 2025, 21:30

I have update all appwrite function to "node-appwrite": "^15.0.1" but before, it's on "^11.1.0" (maybe a little to old xD)

Horsty - Cyril - MagicTools
15 Apr, 2025, 21:30

I can close

John
15 Apr, 2025, 21:31

Glad you were able to solve this!

Horsty - Cyril - MagicTools
15 Apr, 2025, 21:32

look into appwrite version is not the first thing i have think about, specialy because using the Appwrite CLI to push and deploy my function

Horsty - Cyril - MagicTools
15 Apr, 2025, 21:32

So i didn't manage the build of the function

rc_william
15 Apr, 2025, 23:13

I am getting the same error in appwrite python sdk calling either of storage.list_buckets() or storage.get_bucket(bucket_id='<bucket_id>').

Traceback (most recent call last): File "/images/main.py", line 13, in <module> main() ~~~~^^ File "/images/main.py", line 9, in main result = storage.list_buckets() File "/usr/local/lib/python3.13/site-packages/appwrite/services/storage.py", line 42, in list_buckets return self.client.call('get', api_path, { ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ 'content-type': 'application/json', ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }, api_params) ^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/appwrite/client.py", line 137, in call raise AppwriteException(response.text, response.status_code, None, response.text) appwrite.exception.AppwriteException: request cannot have request body

using appwrite==9.0.3

rc_william
15 Apr, 2025, 23:13

any fixes?

rc_william
15 Apr, 2025, 23:15

I think the code is throwing an error in the client.call method on the line data={} which is passed to the requests .get

ZachHandley
15 Apr, 2025, 23:32

please make a new support request

Horsty - Cyril - MagicTools
16 Apr, 2025, 07:44

Maybe like me, update the version of the appwrite that you use

rc_william
16 Apr, 2025, 13:49

Thanks for the suggestion but appwrite==9.0.3 is the latest version.

https://pypi.org/project/appwrite/

Horsty - Cyril - MagicTools
16 Apr, 2025, 13:50

Ok i don’t know about python sorry So indeed créate a dedicated issue =\

ZachHandley
17 Apr, 2025, 21:09

@rc_william please update your SDK, it's been fixed

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more