Back

Internal Runtime Error on Function

  • 0
  • Databases
ianmont
9 Apr, 2023, 17:29

Well so im trying to see more information of an error of a function that is not working, it says "Internal Runtime Error", how can i see the console or how can i find out more about this problem?

TL;DR
The user encountered an "Internal Runtime Error" in their code and is seeking help to debug it. Another user suggests wrapping the code in a try/catch block and checking the logs for more information. The user confirms that this solution worked and plans to fix the error.
Ponguta_
9 Apr, 2023, 17:38

Hello, can you please try to surround all your code in a try/catch, and check logs?

TypeScript
def main(req, res):
  try:
    # All your code here
    return res.json({...})
  except Exception as e:
    print(e)
    return res.json({...})

If it doesnt work, can you share a bit of your code?

ianmont
9 Apr, 2023, 18:09

apparently that worked and it seems to be an error in my code 😓 , I'll see how to fix it, but for now it worked to wrap the code in the try catch, thanks Sergio <:appwritecheers:892495536823861258>

Ponguta_
9 Apr, 2023, 19:17

Nice to hear that. By the way, I use python runtimes aswell, so, if you find yourself needing traceback, you can do the following.

TypeScript
import traceback

def main(req, res):
  try:
    # All your code here
    return res.json({...})
  except Exception as e:
    print(e)
    print(traceback.format_exc())
    return res.json({...})

With this, you are going to be able to see under Logs tab, the traceback, so your debug should be a bit easier.

ianmont
9 Apr, 2023, 19:44

sounds great, thank you

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