
I'm facing a "simple" issue
Invalid response. This usually means too large logs or errors. Please avoid logging files or lengthy strings.\nError Code: 500
I think i've found where it's happen due to a JSON.stringify()
i try to log.
My code is organise like this
function myFunction({log, error}) {
log('Start my function');
try {
// Do some stuff
log(`I get this var: ${myVar}`);
// Do some other stuff that throws an exception
throw "myException"; // Generate an exception
} catch (e) {
error('An error occurred');
error(`Error message: ${JSON.stringify(e)}`); // <-- This throw the error due to too long message
}
}
The issue, is that log
before throw exception are not log. So it's very difficult to debug.

It's possible to have better log in this case ? like stacktrace or even all other valid log ?

I'm expected having something like that
Start my function
I get this var: undefined
An error occurred
Invalid response. This usually means too large logs or errors. Please avoid logging files or lengthy strings.\nError Code: 500
So all before log and the log that appwrite send me due to the too large logs

And after that, how i can log the error ? It's possible to return the error ? Or other way ?
res.send(JSON.stringify(e))

hmm, i don't think doing JSON.stringify(e)
should result in that long error message, but it could be possible in some cases. You can return back content via res.*
methods. Not sure if that has content length limits but these won't be shown on dashboard/console.
One alternative is to use a document to log errors but that feels like an overkill. @Meldiron wdyt?

I will try res.*
in a first try to know what is the actual error i have remove the stringify
And if it's not working i will try with the document to log the error

i need to wait another error that happens ^^
Recommended threads
- Sharing cookies
Hi, I’m using Appwrite Cloud, and I have a setup where my Appwrite backend is hosted on a subdomain (e.g., api.example.com), while my frontend (Next.js app) and...
- Custom Domain Issue
i have added a custom domain about 21 hours ago, but till now there is no SSL certificate is active on it. but if i do DNS check via https://dnschecker.org/#C...
- Flutter OAuth2 Google does not return to...
When the flow starts, the browser opens, I select an account, and it keeps showing: """ Page not found The page you're looking for doesn't exist. `general_rout...
