# Cannot read 'type' of undefined: dispatch assignBugToUser

**URL:** <https://forum.codewithmosh.com/t/cannot-read-type-of-undefined-dispatch-assignbugtouser/3423>\
**Category:** Redux\
**Created:** [March 18, 2021, 2:26pm UTC](https://forum.codewithmosh.com/t/cannot-read-type-of-undefined-dispatch-assignbugtouser/3423 "2021-03-18T14:26:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![agomesd](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@agomesd](https://forum.codewithmosh.com/u/agomesd)\
**Post date:** [March 18, 2021, 2:26pm UTC](https://forum.codewithmosh.com/t/cannot-read-type-of-undefined-dispatch-assignbugtouser/3423/1 "2021-03-18T14:26:59Z")

</div>

Hello, I’m going mad here but I seem to be missing something.

I keep getting this error:

![Screenshot 2021-03-18 at 15.21.20](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/b/b67e33baf44c11e785639061c5897bbe7370ab9b.png)

when dispatching assignBugToUser:

![Screenshot 2021-03-18 at 15.23.00](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/9/9a036d081ebcd8b78c5ac96f724b118ce0588218.png)

Here is my action creator:

![Screenshot 2021-03-18 at 15.24.07](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/5/56f418580330dc74224a404b681e58579536147c.png)

And here is my reducer:

![Screenshot 2021-03-18 at 15.24.58](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/d/d76ab829b835cfb63add6041dcb505b8d98897da.png)

I’ve tried comparing my code to Mosh’s code but cannot find where I’m going wrong?? Also what is the best approach to debug these type of errors?

Thanks in advance for the help!

---

<div class="post-metadata">

**Author:** ![agomesd](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@agomesd](https://forum.codewithmosh.com/u/agomesd)\
**Post date:** [March 19, 2021, 4:25pm UTC](https://forum.codewithmosh.com/t/cannot-read-type-of-undefined-dispatch-assignbugtouser/3423/2 "2021-03-19T16:25:15Z")

</div>

I found the problem: it seems to be happening because I put the apiCallBegan function inside curly braces in the assignBugToUser function. Is it because I was passing an object instead of a function to the action creator?  
Taking the curly braces out made it work.
