Our flow runs have started failing today with the ...
# prefect-cloud
p
Our flow runs have started failing today with the following error:
Copy code
prefect.exceptions.ScriptError: Script at 'flows/meta_subscriptions.py' encountered an exception: AttributeError("cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_ED448'")
We hadn't change the code in a couple of months and things have been running smoothly. Also, just checked and we have our Python libraries with fixed version numbers
1
The stacktrace points at something iffy in the snowflake connector:
Copy code
Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/prefect/analytics-data-pipeline-main/flows/meta_subscriptions.py", line 12, in <module>
    from prefect_snowflake import SnowflakeConnector
  File "/usr/local/lib/python3.10/site-packages/prefect_snowflake/__init__.py", line 2, in <module>
    from prefect_snowflake.credentials import SnowflakeCredentials  # noqa
  File "/usr/local/lib/python3.10/site-packages/prefect_snowflake/credentials.py", line 21, in <module>
    import snowflake.connector
  File "/usr/local/lib/python3.10/site-packages/snowflake/connector/__init__.py", line 19, in <module>
    from .connection import SnowflakeConnection
  File "/usr/local/lib/python3.10/site-packages/snowflake/connector/connection.py", line 35, in <module>
    from . import errors, proxy
  File "/usr/local/lib/python3.10/site-packages/snowflake/connector/errors.py", line 18, in <module>
    from .telemetry_oob import TelemetryService
  File "/usr/local/lib/python3.10/site-packages/snowflake/connector/telemetry_oob.py", line 22, in <module>
    from .vendored import requests
  File "/usr/local/lib/python3.10/site-packages/snowflake/connector/vendored/requests/__init__.py", line 119, in <module>
    from ..urllib3.contrib import pyopenssl
  File "/usr/local/lib/python3.10/site-packages/snowflake/connector/vendored/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.crypto
  File "/usr/local/lib/python3.10/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import SSL, crypto
  File "/usr/local/lib/python3.10/site-packages/OpenSSL/SSL.py", line 11, in <module>
    from OpenSSL._util import (
  File "/usr/local/lib/python3.10/site-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/usr/local/lib/python3.10/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 132, in <module>
    Binding.init_static_locks()
  File "/usr/local/lib/python3.10/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 100, in init_static_locks
    cls._ensure_ffi_initialized()
  File "/usr/local/lib/python3.10/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 93, in _ensure_ffi_initialized
    cls.lib = build_conditional_library(
  File "/usr/local/lib/python3.10/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 48, in build_conditional_library
    if not getattr(lib, condition):
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_ED448'. Did you mean: 'Cryptography_HAS_ALPN'?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 426, in retrieve_flow_then_begin_flow_run
    )
  File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 100, in with_injected_client
    return await fn(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/prefect/deployments/deployments.py", line 322, in load_flow_from_flow_run
    @deprecated_callable(start_date="Mar 2024")
  File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 136, in run_sync_in_worker_thread
  File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/prefect/flows.py", line 1682, in load_flow_from_entrypoint
    flow = import_object(entrypoint)
  File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 205, in import_object
    elif "." in import_path:
  File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 168, in load_script_as_module
    sys.path.remove(working_directory)
prefect.exceptions.ScriptError: Script at 'flows/meta_subscriptions.py' encountered an exception: AttributeError("cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_ED448'")
v
Also started seeing this a couple days back. any solutions to get past this issue? have tried downgrading snowflake-connector-python ; changing workpool image, but nothing helped.
@Pablo Recio - any luck figuring this out?
i was able to fix this by adding this in the Pip Packages section of the work pool:
Copy code
["cryptography==42.0.8"]