# Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body

**URL:** <https://forum.dfinity.org/t/failed-to-execute-fetch-on-window-request-with-get-head-method-cannot-have-body/38112>\
**Category:** Developers\
**Created:** [December 2, 2024, 7:48pm UTC](https://forum.dfinity.org/t/failed-to-execute-fetch-on-window-request-with-get-head-method-cannot-have-body/38112 "2024-12-02T19:48:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![baolongt](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@baolongt](https://forum.dfinity.org/u/baolongt)\
**Post date:** [December 2, 2024, 7:48pm UTC](https://forum.dfinity.org/t/failed-to-execute-fetch-on-window-request-with-get-head-method-cannot-have-body/38112/1 "2024-12-02T19:48:39Z")

</div>

My canister used to work normal with an update call, but yesterday some how it return this error. I did change some code but not relate to this function and also all other update calls work correctly. The update called is success based on the logs, but in client side it always behavior like this  
Even I tried force return a `Ok(MockReturn)` it will success but after change canister’s code back it still got this error.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [December 3, 2024, 9:14am UTC](https://forum.dfinity.org/t/failed-to-execute-fetch-on-window-request-with-get-head-method-cannot-have-body/38112/2 "2024-12-03T09:14:33Z")

</div>

What are the changes you make that break the code? Can you show us your code? To me this looks more like a JS issue…

---

<div class="post-metadata">

**Author:** ![baolongt](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@baolongt](https://forum.dfinity.org/u/baolongt)\
**Post date:** [December 3, 2024, 11:13am UTC](https://forum.dfinity.org/t/failed-to-execute-fetch-on-window-request-with-get-head-method-cannot-have-body/38112/3 "2024-12-03T11:13:44Z")

</div>

I found a way to fix it but don’t know why it behavior like this, it used to work before

My code used useAgent from IdentityKit  
now I changed to this code

```auto
import { useIdentity } from "@nfid/identitykit/react";

 const identity = useIdentity();
  const agent = HttpAgent.createSync({
      host: DEFAULT_ICP_URL,
      identity: identity,
  });

```

---

<div class="post-metadata">

**Author:** ![sam-thetutor](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/sam-thetutor/32/19114_2.png) [@sam-thetutor](https://forum.dfinity.org/u/sam-thetutor)\
**Post date:** [December 7, 2024, 5:12am UTC](https://forum.dfinity.org/t/failed-to-execute-fetch-on-window-request-with-get-head-method-cannot-have-body/38112/4 "2024-12-07T05:12:25Z")

</div>

I just used your solution to fix the same error that I encountered and it has worked very well. 👍 👍

---

<div class="post-metadata">

**Author:** ![baolongt](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@baolongt](https://forum.dfinity.org/u/baolongt)\
**Post date:** [December 7, 2024, 6:33am UTC](https://forum.dfinity.org/t/failed-to-execute-fetch-on-window-request-with-get-head-method-cannot-have-body/38112/5 "2024-12-07T06:33:41Z")

</div>

seems we encounter some same error, can you share me your dependencies version. I’m helping IdentityKit team re-produce this issue

---

<div class="post-metadata">

**Author:** ![sam-thetutor](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/sam-thetutor/32/19114_2.png) [@sam-thetutor](https://forum.dfinity.org/u/sam-thetutor)\
**Post date:** [December 7, 2024, 6:57am UTC](https://forum.dfinity.org/t/failed-to-execute-fetch-on-window-request-with-get-head-method-cannot-have-body/38112/6 "2024-12-07T06:57:59Z")

</div>

I was facing the issue [here](https://forum.dfinity.org/t/typeerror-cannot-read-properties-of-undefined-reading-body/38535) with identityKit 1.0.1. I then updated the version to 1.0.2 and thats when i faced the issue here. I was also using the agent from useAgent hook. But now, everything is running smoothly after implementing your solution
