Python Google Cloud Function V2 - SSL Error

I’m trying to integrate chat completions in my FlutterFlow web application using a Firebase Python Cloud Function V2. I’m using the OpenAI library for streaming to receive the responses. The function works fine in my Firebase emulators, but when I run it on the cloud, I encounter an error after 4 requests:
“ssl.SSLEOFError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1002)”.

Here’s what I’ve tried so far:

  • Using a proxy.
  • Using the request module directly instead of the OpenAI library.
  • Adding a sleep of at least 1 minute between each request.

Could you please assist me in resolving this issue?

Welcome to the Forum! Please post the code segment that is generating the error, and any setup code that it relies upon.