2023-06-07

Why does a Python request from Firebase Cloud Functions result in a CoreFoundation error?

I am attempting to make a request to a third party API via a python script in a Firebase cloud function (2nd generation cloud functions python public preview):

def foo(req: https_fn.Request) -> https_fn.Response:
    url = 'https://catfact.ninja/fact'
    res = requests.get(url)
    return json.dumps(res.json())

When I call this function, I get the following error:

The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec(). Break on THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC() to debug.

I know this is related to the request because when I remove the request this error no longer occurs. I read online that this issue was a Mac related thing and I am indeed on a Mac. I also tried simply executing the above request in a separate python file, which worked fine. This leads me to believe this issue is related to something in Firebase Functions. Does anyone know what's going on here?



No comments:

Post a Comment