I got <https://docs.prefect.io/api-ref/prefect/exc...
# prefect-community
p
I got https://docs.prefect.io/api-ref/prefect/exceptions/#prefect.exceptions.ScriptError This error while running a flow through cloud UI. When I run the script using simple python flow it doesn't fail, but while running via deployment gives Script error. Prefect as documented the error but not given what might be the probable solution
1
j
Can you please share the code and logs in this thread?
p
Copy code
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/pranitsherkar/prefect/talend_fact_shopify_dailysales_productperformance.py", line 8, in <module>
    talend_fact_shopify_dailysales_productperformance()
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/flows.py", line 384, in __call__
    return enter_flow_run_engine_from_flow_call(
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/engine.py", line 156, in enter_flow_run_engine_from_flow_call
    return anyio.run(begin_run)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/client.py", line 104, in with_injected_client
    return await fn(*args, **kwargs)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/engine.py", line 229, in create_then_begin_flow_run
    state = await begin_flow_run(
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/engine.py", line 357, in begin_flow_run
    await result_filesystem._save(is_anonymous=True)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/blocks/core.py", line 688, in _save
    await self.register_type_and_schema(client=client)
TypeError: object NoneType can't be used in 'await' expression

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

Traceback (most recent call last):
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/engine.py", line 254, in retrieve_flow_then_begin_flow_run
    flow = await load_flow_from_flow_run(flow_run, client=client)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/client.py", line 104, in with_injected_client
    return await fn(*args, **kwargs)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/deployments.py", line 73, in load_flow_from_flow_run
    flow = await run_sync_in_worker_thread(import_object, str(import_path))
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/utilities/asyncutils.py", line 56, in run_sync_in_worker_thread
    return await anyio.to_thread.run_sync(call, cancellable=True)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/utilities/importtools.py", line 193, in import_object
    module = load_script_as_module(script_path)
  File "/home/pranitsherkar/.local/lib/python3.8/site-packages/prefect/utilities/importtools.py", line 156, in load_script_as_module
    raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at '/home/pranitsherkar/prefect/talend_fact_shopify_dailysales_productperformance.py' encountered an exception
j
Are you able to show the code?
p
code within flow?
j
Ah, sorry, I see there’s another thread you were working on with @Ryan Peden. If you can put all the details related to the current issue in this thread I think that would be helpful for the community and Prefect team as we try to assist.
p
No that issue was resolved
this is next issue coming after that
Which is strange and documented in prefect as exception but reason isnt listed
j
Hmm. Gotcha. Can you please share the code and any command line commands and other relevant info here?
p
I have already pasted the error above. Scenario: 1. I am able to run the job using direct python command
python /home/pranitsherkar/prefect/talend_fact_shopify_dailysales_productperformance.py
2. When I am starting an agent and executing the deployment through cloud
Copy code
TypeError: object NoneType can't be used in 'await' expression
prefect.exceptions.ScriptError: Script at '/home/pranitsherkar/prefect/talend_fact_shopify_dailysales_productperformance.py' encountered an exception
Copy code
from prefect import flow
from prefect_airbyte.connections import trigger_sync


@flow
def airbyte_shopify_drinkdrummerboy():

      # Run other tasks and subflows here

      trigger_sync(
            connection_id="",
            poll_interval_s=3,
            status_updates=True
      )

airbyte_shopify_drinkdrummerboy()
j
Thank you the code looks like it might be helping us. Might be an issue with the airbyte integration.
We just released Prefect 2.3.1 today with a number of bug fixes. If you upgrade and recreate the deployment does it work then?
If that doesn't it work, it's possible you found a big in the prefect-airbyte collection and I would file an issue there: https://github.com/PrefectHQ/prefect-airbyte