HTTP function throwing error 500.

I haven’t gone over your code, but some errors just popped up:
You forgot to put a return before all the Promises.

  • you don’t return any http response.
    Please fix it, and then if it’s still doesn’t work, post the fixed code.