Back

[SOLVED] "Error Msg: Http invalid protocol" After my function runs successfully.

  • 0
  • Functions
conleyc86
29 Sep, 2023, 20:32

same with commenting out some of the data

TL;DR
After solving a 500 error that occurred after successfully running a function, the issue was identified as the function being too slow. The solution was to index the ingested data and batch document creation/updating. The function now runs in under a minute.
D5
29 Sep, 2023, 20:32

I recommend trying to get only 1 response. Maybe that's causing a confilct

D5
29 Sep, 2023, 20:32

Since the function is supposed to stop being executed when a response is returned

conleyc86
29 Sep, 2023, 20:34

Right on - I removed the return statement and it's running right now

conleyc86
29 Sep, 2023, 20:40

Yeah same error still and same logs

D5
29 Sep, 2023, 20:47

You're triggering the function from SDK?

Drake
29 Sep, 2023, 20:50

How long does it run for?

conleyc86
29 Sep, 2023, 20:51

from the appwrite console

conleyc86
29 Sep, 2023, 20:51

however long I set the timeout to

Drake
29 Sep, 2023, 20:52

Maybe you're running into the timeout then

D5
29 Sep, 2023, 20:52

Try setting it to like 2 minutes. I think that will be enough

conleyc86
29 Sep, 2023, 20:53

I was wondering so I upped it to 5 minutes and same problem

Drake
29 Sep, 2023, 20:54

Make sure to call return like return res.json().

Make sure you're only passing a single string to log()

Drake
29 Sep, 2023, 20:56

Maybe it's really taking that long

D5
29 Sep, 2023, 20:56

He's not calling it with JSON, but I think it should be fine anyways?

Drake
29 Sep, 2023, 20:57

I see multiple arguments being passed to log

D5
29 Sep, 2023, 20:57

Oh, yes, the latest line confused me 😅

conleyc86
29 Sep, 2023, 21:06

Whoops about the logs, fixed those and added a return statement to the try block and timed out at 2 minutes - it's only like 2k documents with 10 attributes but I'll up it to 10 minutes and see what happens

conleyc86
29 Sep, 2023, 21:07

@Steven @D5 appreciate the help guys - I make sure to bang my head on my keyboard at least a thousand times before asking for help but this 500 error was baffling me

D5
29 Sep, 2023, 21:09

No issues, don't hesitate to ask anything at any time! We will always try to help 😄

D5
30 Sep, 2023, 08:14

@conleyc86 This got solved from what I understand, true?

conleyc86
3 Oct, 2023, 00:51

Yes! The function was too slow - indexing the ingested data and batching document creation/updating solved it - function runs in under a minute

conleyc86
3 Oct, 2023, 00:51

Thanks again!

conleyc86
3 Oct, 2023, 00:52

Also sorry for the slow reply - this is for a personal project just revisited it today.

D5
3 Oct, 2023, 05:08

[SOLVED] "Error Msg: Http invalid protocol" After my function runs successfully.

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