https://prefect.io logo
#prefect-community
Title
# prefect-community
n

Nikhil Jain

01/18/2023, 4:32 AM
Getting an error when calling prefect client api through a lambda function:
Copy code
"RuntimeError: Orion requires sqlite >= 3.24.0 but we found version 3.7.17\n"
I am using prefect2 cloud app with no changes for sqlite. Any ideas why this is happening?
z

Zanie

01/18/2023, 4:47 AM
Sounds like
PREFECT_API_URL
isn’t set in the lambda, is it?
Basically I don’t think we should check the SQLite version unless you’re not connecting to an API server.
n

Nikhil Jain

01/18/2023, 4:51 AM
hmm… I am fetching the
PREFECT_API_URL
in the lambda from AWS SSM prior to creating the prefect client. But I guess it’s probably too late because prefect module has already been loaded and it does not find PREFECT_API_URL ? So this should be set in the ENV before any modules are loaded?
Is there a way to instantiate settings from os env after prefect module has been loaded?
z

Zanie

01/18/2023, 5:07 AM
Yeah you want to set it beforehand. You can do
with prefect.settings.temporary_settings():
I’m not sure that will force a load from the environment again
You could set the API URL there though
n

Nikhil Jain

01/18/2023, 5:14 AM
I also noticed an error on the lambda invocation:
Copy code
/var/task/prefect/context.py:493: UserWarning: Failed to create the Prefect home directory at /home/sbx_user1051/.prefect
Is this important to fix? I can try to set PREFECT_HOME to a directory where the lambda will have write permission.
btw, I was able to set PREFECT_API_URL through the serverless environment so it should be available prior to module loading. so thanks for helping with that.
🙌 1
z

Zanie

01/18/2023, 5:16 AM
Hm I’m not sure what will happen if the home directory can’t be created — it’ll fail when you’re not connecting to an external API but it should be fine when you are.
You can always change the home directory if you need to 👍
n

Nikhil Jain

01/18/2023, 5:18 AM
not sure what you mean by “connecting to an external API”. I am connecting to the prefect cloud server.
3 Views