Back

[SOLVED] Simple Function Timing Out

  • 0
  • Self Hosted
  • Functions
Drake
29 Oct, 2023, 01:13

you might need to create a document and store the data in there

TL;DR
Summary: The user's simple function is timing out and they are seeking assistance on how to resolve the issue. They inquire about Appwrite's plans for creating a wrapper for function responses via websockets. They also question why their function is failing randomly even though the Appwrite ID is valid and present. The response suggests trying to execute the function asynchronously and increasing the timeout to identify the real error. The user is unsure why their non-long running synchronous function is timing out and asks for an example of a non-blocking asynchronous function. The support team clarifies that since version 1.4, Appwrite doesn't store the response anymore and
ZachHandley
29 Oct, 2023, 19:38

I thought the data from creating the execution would have the response in it

ZachHandley
29 Oct, 2023, 19:39

so I could just wait until the getExecution status is okay, checking every X timeout depending on the function, and then the response should have it right?

ZachHandley
29 Oct, 2023, 19:42

@HolyByte, The Iron Oxide Jedi

Drake
29 Oct, 2023, 20:14

No. Since 1.4, we don't store the response anymore

ZachHandley
29 Oct, 2023, 20:25

huh, okay so if I want a non-blocking asynchronous function that returns data, do you have an example of that or is that just not intended at all?

ZachHandley
29 Oct, 2023, 20:29

Cause at that point, in any high level application with thousands of requests, my functions are pretty worthless in that regard

Drake
29 Oct, 2023, 20:52

Not intended. Long running synchronous functions don't scale.

ZachHandley
29 Oct, 2023, 20:52

this one isn't long running, nor are my others

ZachHandley
29 Oct, 2023, 20:52

I actually am not sure why it timed out

ZachHandley
29 Oct, 2023, 20:52

Cause that one is literally just "getUserByAppwriteId" basically

ZachHandley
29 Oct, 2023, 20:52

it gets a document and returns it, nothing else was running

Drake
29 Oct, 2023, 20:53

Then something is wrong with your code

ZachHandley
29 Oct, 2023, 20:53

how can it be? It's above

ZachHandley
29 Oct, 2023, 20:53

it's just getting the appwriteId (which it does cause it's logged) then it does getDocument

ZachHandley
29 Oct, 2023, 20:53

could the Bun runtime have an issue?

Drake
29 Oct, 2023, 20:54

Try executing your function asynchronously and increasing the timeout. Maybe you'll see the real error

ZachHandley
29 Oct, 2023, 21:08

I'm genuinely asking here, if the Appwrite ID is in the given function above (which it is valid and present), shouldn't it always either fail or not fail? What other possible thing could be happening here where you're thinking there's an error I'm missing? Cause it's just using getDocument, am I missing something?

ZachHandley
29 Oct, 2023, 21:09

it works 99% of the time, it just failed a few times randomly

ZachHandley
29 Oct, 2023, 21:09

and usually in 13-15 ms

Drake
29 Oct, 2023, 21:09

I'm not sure

ZachHandley
29 Oct, 2023, 21:16

huh, weird, okay, thank you regardless, do you guys have any plans to write a wrapper for function responses via like idk websockets or something? It would be cool to be able to run ~3-5 second functions asynchronously and have them return the response appropriately, I was thinking setTimeout but if they don't have the responseBody it doesn't work so I was maybe thinking Webhooks. They're not meant to be scalable per-se, but AI functions sometimes take a second to return a response, it's not computationally heavy just an API

Drake
29 Oct, 2023, 21:18

Not at the moment.

The response body is supposed to be able to be anything now. As such, Appwrite can't store it

ZachHandley
29 Oct, 2023, 21:19

gotcha, understood, thank you!

ZachHandley
29 Oct, 2023, 21:19

[SOLVED] Simple Function Timing Out

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