Back

[SOLVED] How to use account.get() in functions?

  • 0
  • Functions
  • Web
NEETO
29 May, 2023, 17:36

I am trying to get user data from cloud functions but is not working, there are no logs and no errors.

TL;DR
Title: [SOLVED] How to use account.get() in functions? Issue: User is unable to retrieve user data from cloud functions using account.get(). No logs or errors are being generated. Solution: The error was due to the else block that sets the endpoint not being called. The user needed to convert the error to a string instead of passing the error itself. Additionally, it was suggested to try converting the entire error using error.toString(). This resolved the issue and the user was able to successfully use account.get() in functions.
NEETO
29 May, 2023, 17:39

I tried account.get() with jwt passed via payload same problem.

NEETO
29 May, 2023, 17:40

getting this response.

Drake
29 May, 2023, 17:41

Can you try to convert the error to a string instead of passing the error itself?

NEETO
29 May, 2023, 17:43

showing {"error":"[object Undefined]"}

Drake
29 May, 2023, 17:44

How did you convert it?

NEETO
29 May, 2023, 17:44

error: toString(error)

Drake
29 May, 2023, 17:45

Can you try error.toString()?

NEETO
29 May, 2023, 17:46

Ah!

NEETO
29 May, 2023, 17:46

{"error":"Error: getaddrinfo ENOTFOUND hostname"}

Drake
29 May, 2023, 17:48

There you go. That else block that sets the endpoint isn't being called

NEETO
29 May, 2023, 17:49

Thanks.

Guille
29 May, 2023, 19:53

It was your issue solved @NEETO ?

NEETO
12 Jun, 2023, 16:46

yes.

Guille
12 Jun, 2023, 16:52

[SOLVED] How to use account.get() in functions?

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