https://prefect.io logo
Title
t

Thet Naing

12/27/2022, 6:37 PM
Hi all, I have been having some significant trouble using the
GcpCredentials
block in both the Prefect UI and the Python API. I am able to save the credentials on the UI, but when I load the credentials, I get a Pydantic
JSONDecodeError
. When I try to save the credentials from Python, I get the same error. Anybody know a solution or workaround?
👀 1
1
b

Bianca Hoch

12/27/2022, 6:43 PM
Hello Thet, we received your report through email. We will continue our investigation and provide updates via email if that's alright with you! If someone has any additional information, I'm sure they'll contribute here as well.
👍 1
t

Thet Naing

12/27/2022, 6:43 PM
Thank you!
👍 1
If it helps--the block is showing the full information of the credentials, and is not obfuscated
Similar to what is shown here: https://github.com/PrefectHQ/prefect-gcp/issues/73
👍 1
a

Andrew Huang

12/27/2022, 7:28 PM
Can you share which version of prefect-gcp you’re using? v0.2.1 should fix this issue, but let me know if that’s not the case!
:gratitude-thank-you: 1
:upvote: 1
b

Bianca Hoch

12/27/2022, 8:36 PM
Just looping back here, a solution was found! I'll add some details for context in case anyone else runs into a similar error. • Version information:
prefect==2.7.3
and
prefect-gcp==0.2.1
• Their team just switched over to an org from a personal workspace, and the PREFECT_API_URL and PREFECT_API_KEY were updated accordingly • Problem: The profile was pulling incorrect environment variables, resulting in the
JSONDecodeError
below when trying to run something from the CLI (Thet, feel free to add or correct me if I'm missing something)
:marvin: 1
:thank-you: 4
Traceback (most recent call last):
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/prefect/cli/_utilities.py", line 41, in wrapper
 return fn(*args, **kwargs)
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 205, in coroutine_wrapper
 return run_async_in_new_loop(async_fn, *args, **kwargs)
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 156, in run_async_in_new_loop
 return anyio.run(partial(__fn, *args, **kwargs))
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
 return asynclib.run(func, *args, **backend_options)
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
 return native_run(wrapper(), debug=debug)
 File "/Users/thet/.pyenv/versions/3.10.9/lib/python3.10/asyncio/runners.py", line 44, in run
 return loop.run_until_complete(main)
 File "/Users/thet/.pyenv/versions/3.10.9/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
 return future.result()
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
 return await func(*args)
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/prefect/cli/agent.py", line 163, in start
 async with anyio.create_task_group() as tg:
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 662, in __aexit__
 raise exceptions[0]
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/prefect/utilities/services.py", line 46, in critical_service_loop
 await workload()
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/prefect/agent.py", line 163, in get_and_submit_flow_runs
 async for work_queue in self.get_work_queues():
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/prefect/agent.py", line 124, in get_work_queues
 work_queue = await self.client.read_work_queue_by_name(name)
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/prefect/client/orion.py", line 720, in read_work_queue_by_name
 return schemas.core.WorkQueue.parse_obj(response.json())
 File "/Users/thet/SystemInternal/information-extraction-pipeline/venv/lib/python3.10/site-packages/httpx/_models.py", line 752, in json
 return jsonlib.loads(self.text, **kwargs)
 File "/Users/thet/.pyenv/versions/3.10.9/lib/python3.10/json/__init__.py", line 346, in loads
 return _default_decoder.decode(s)
 File "/Users/thet/.pyenv/versions/3.10.9/lib/python3.10/json/decoder.py", line 337, in decode
 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
 File "/Users/thet/.pyenv/versions/3.10.9/lib/python3.10/json/decoder.py", line 355, in raw_decode
 raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
An exception occurred.
t

Thet Naing

12/29/2022, 5:11 PM
Thanks for looking into this! Just as a note, I think it would be really helpful for Prefect to catch and wrap this exception so that it is clear that this is an issue with connecting to the API
👀 1