Back

My cloud function's deployment fails undeterministically with an error

  • 0
  • Functions
Toli
21 Nov, 2023, 13:12

The same deployment, when I re-deploy it, has some non-deterministic chance to fail. Why would it happen and how do I ensure it's deployed correctly every time?

TL;DR
Cloud function deployment fails intermittently with an error related to storing logs in a MySQL database. The issue occurs randomly and only in Python. The deployment script uses `pip install -r requirements.txt`. It is suspected that one of the libraries in the requirements file may be causing the problem. The proposed solution is to create a requirements file on the user's end and perform multiple deployments to pinpoint the problematic library. The error message also suggests a possible issue with Appwrite's backend. A user is seeking insights into the cause and possible code elements that might contribute to the problem.
Meldiron
21 Nov, 2023, 13:14

Hey there 👋 I have been trying to reproduce this for a long time now 😔 Do you have any insights into why this might be hapenning? How often, and possibly what pieces of code could cause it?

Meldiron
21 Nov, 2023, 13:14

So far I know it's random, and only in Python

Toli
21 Nov, 2023, 13:18

Not much insight, except that it came to my awareness only when I started using context.log inside my Python program.

Also, ChatGPT said it has something to do with a MySQL database given the error message - maybe something on Appwrite's backend?

Toli
21 Nov, 2023, 13:19

Ah, another thing: in my deployment script, I only have pip install -r requirements.txt. The failure happens after the requirements are installed.

Meldiron
21 Nov, 2023, 13:19

Correct, problem is with storing logs. Allowing this on database-level could introduce security issue with some null values. Database team asked me to try to reproduce and see what log exactly is problematic, and do some encoding instead.

What are you putting into context log?

Meldiron
21 Nov, 2023, 13:20

This sounds more reasonable to me. Something internally is doing some native logs, which are then being sent as logs to DB. Do you have any insight on which lib it could be?

Toli
21 Nov, 2023, 13:21

I have the following libs in the requirements file:

TypeScript
appwrite==4.0.0
openai==1.3.2
pinecone-client==2.2.4
python-dotenv==1.0.0
google-api-python-client==2.108.0
google-auth-httplib2==0.1.1
google-auth==2.23.4
tiktoken==0.5.1

One way to go might be to create a requirements file on your end with those libs and just spam deployments until it happens?

Toli
21 Nov, 2023, 13:22

I don't think it's the context.log statement inside the code - I mean, my code shouldn't run on deployment time, right?

Meldiron
21 Nov, 2023, 13:22

Oh, ooooh it's deployment. Usually people report this with executions

Toli
21 Nov, 2023, 13:22

Yes, it's the deployment, not the execution

Meldiron
21 Nov, 2023, 13:22

Ill try your requirements and see if I can reproduce locally

Toli
21 Nov, 2023, 13:23

Let me know if you find anything!

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