# Promise then(...) always return 'undefined'

**URL:** <https://forum.codewithmosh.com/t/promise-then-always-return-undefined/2680>\
**Category:** Node\
**Created:** [February 15, 2021, 1:57pm UTC](https://forum.codewithmosh.com/t/promise-then-always-return-undefined/2680 "2021-02-15T13:57:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fmarsella](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@fmarsella](https://forum.codewithmosh.com/u/fmarsella)\
**Post date:** [February 15, 2021, 1:57pm UTC](https://forum.codewithmosh.com/t/promise-then-always-return-undefined/2680/1 "2021-02-15T13:57:13Z")

</div>

**From Node Lecture Asynchronous JavaScript : 8- Consuming Promises**  
Hello Forum,

I’m confused why the third then( ) always return undefined.

```
getUser(1)
 .then(user => getRepositories(user.gitHubUsername))
 .then(repository => getCommits(repository[0]))
 .then(com => console.log('Commit', com)) // this always return 'undefined'
 .catch(error => console.log('Error', error.message ));

```

Thanks,  
Fmarsella

Following are the rest of my codes:

 ![Screen Shot 2021-02-15 at 14.55.52](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/1X/f768d777426e8b0609270b9d520f07559f225efc.png)

---

<div class="post-metadata">

**Author:** ![Samaty](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@Samaty](https://forum.codewithmosh.com/u/Samaty)\
**Post date:** [February 22, 2021, 2:07pm UTC](https://forum.codewithmosh.com/t/promise-then-always-return-undefined/2680/2 "2021-02-22T14:07:58Z")

</div>

hi,

have a look at your getCommits function; you’ve forgotten to add “return” before " new Promise…"
