When i execute the following code(NodeJS runtime), using the context.error or context.log functions to log the error, it logs an empty object instead of the actual error.
TypeScript
await asyncFunc()
}
catch(err) {
console.log(err)
error(err)
return res.empty()
}```
Old fashioned console.log() logs the error just fine though.
TL;DR
Title: [SOLVED] context.error not logging error content
Issue: When using context.error or context.log to log an error, it logs an empty object instead of the actual error content.
Solution: Use err.toString() instead of trying to stringify objects.
Code example:
```
try {
await asyncFunc()
}
catch(err) {
console.log(err)
error(err.toString())
return res.empty()
}
```
Using console.log() instead of context.error or context.log works fine.Open Runtimes tries to stringify objects but that doesn't work on errors. You should do err.toString() instead.
Thanks <:appwritefire:823999000330895380>
[SOLVED]context.error does not log the error content
Recommended threads
- Functions not executing after usage rese...
Hi team, Last month my project hit 100% usage and functions stopped working (expected). Now the new month has started and usage has reset, requests are going ...
- Functions never end and always fail (sta...
Hi ! I'm using Appwrite Cloud Pro and function execution from appwrite website is KO. Deploying starter function template, execution is always Failed and the ...
- Provider error when creating a function ...