Back

Having this problem with a function

  • 0
  • Functions
  • Cloud
ianmont
4 Oct, 2023, 22:35

Im trying to execute a function but every time it fails saying "getAllModules.then is not a function".

What could be happening?

I will attach an image of my code to this message in case it helps

TL;DR
The user is having trouble with a function that throws an error "getAllModules.then is not a function". There are two links provided for further reading about promises and async/await. The user is advised to return the promise instead of using `await` in their code. No solution is provided in the thread, so further troubleshooting may be needed.
Kim
4 Oct, 2023, 23:19

You're using await instead of returning the promise. Looks at the example code in the docs. https://appwrite.io/docs/products/databases/documents#list-documents

Kim
4 Oct, 2023, 23:20

This is also a good read to understand the difference between promise and async/await. πŸ‘ https://www.freecodecamp.org/news/async-await-and-promises/

ianmont
4 Oct, 2023, 23:29

thanks I'll take a look πŸ‘€

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