@everyone
Still, the first log should be recorded, right? "Log started"
Votes
0
Replies
24
Participants
Unknown
Messages
25
@everyone
Still, the first log should be recorded, right? "Log started"
Yeap it should but it's probably getting missed out due to some error
@everyone
Added the catch. still doesn't work. No logs recorded, and no error recorded either.
You should also parse the payload before accessing
@everyone
Before I do all that, I need to know why the logs doesn't work.
@everyone
No need to parse payload, or other things. If the logs doesn't work, how do I debug then?
Admin
If an exception is thrown, logs may not be captured properly
Logs are a bit patchy at the moment and these are being resolved with the next update to functions. Until then we gotta do some hacking to figure out the issue
@everyone
I edited the function to only do console.log(), without any import, etc.
@everyone
The error tabs shows this:
An internal curl error has occurred within the executor! Error Msg: Operation timed out
@everyone
Do note, that the error above was not thrown in the previous executions.
Are you in Appwrite cloud or running locally?
@everyone
Locally
Okay can you run docker compose logs openruntimes-executor?
Admin
Did you call res.send() or res.json() exactly once before returning?
What exactly was your code?
@everyone
appwrite-executor | Executing Runtime: 642290b69993a0d3e9bf-6423c9778fe107c36c6d
appwrite-executor | [Error] Type: Exception
appwrite-executor | [Error] Message: An internal curl error has occurred within the executor! Error Msg: Operation timed out
appwrite-executor | [Error] File: /usr/src/code/app/executor.php
appwrite-executor | [Error] Line: 544
Rank 3: Container
how was your function after adding the catch?
What did your function look like when you got this error?
Rank 3: Container
req.payload is a string, I think it should be converted before calling
Rank 3: Container
I had this same problem in the morning
Rank 3: Container
Rank 3: Container
payload A JSON string containing the data when you created the execution.
@everyone
So, I figure the problem, I have to return the whole promise. Or else, the function just doesn't work.
Modified code:
return database.listDocuments(
'DB_ID',
'COLLECTION_ID'
).then((list) => {
console.log(list.total)
if (list.total > 0) {
const doc = list.documents[0]
res.json(doc)
}
res.send('Not found')
})
Aah gotcha