Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
I recently (18 March 2025) started getting a typing error when fetching jobs from snapshot queries using the python client library. I haven't changed anything since I started getting this error, so I'm inclined to believe there is an issue with the typing logic. This is my stacktrace:
File "/Users/asj18a/code/snowflake-extract-load/CanvasSrc/CanvasDataInteraction.py", line 387, in run_job
job = await session.query_snapshot(
│ └ <function DAPSession.query_snapshot at 0x128518860>
└ <dap.api.DAPSession object at 0x1285d7110>
File "/Users/asj18a/code/snowflake-extract-load/.venv/lib/python3.11/site-packages/dap/api.py", line 393, in query_snapshot
job = await self._post(f"/dap/query/{namespace}/table/{table}/data", query, Job) # type: ignore
│ │ │ └ typing.Union[dap.dap_types.TableJob, dap.dap_types.CompleteSnapshotJob, dap.dap_types.CompleteIncrementalJob, dap.dap_types.F...
│ │ └ SnapshotQuery(format=<Format.Parquet: 'parquet'>, mode=None)
│ └ <function DAPSession._post at 0x1285185e0>
└ <dap.api.DAPSession object at 0x1285d7110>
File "/Users/asj18a/code/snowflake-extract-load/.venv/lib/python3.11/site-packages/dap/api.py", line 311, in _post
return await self._process(response, response_type)
│ │ │ └ typing.Union[dap.dap_types.TableJob, dap.dap_types.CompleteSnapshotJob, dap.dap_types.CompleteIncrementalJob, dap.dap_types.F...
│ │ └ <ClientResponse(https://api-gateway.instructure.com/dap/query/canvas/table/grading_period_groups/data) [200 OK]>
│ │ <CIMultiDict...
│ └ <function DAPSession._process at 0x128518720>
└ <dap.api.DAPSession object at 0x1285d7110>
File "/Users/asj18a/code/snowflake-extract-load/.venv/lib/python3.11/site-packages/dap/api.py", line 360, in _process
response_object = json_to_object(response_type, response_payload)
│ │ └ {'id': 'b9ea26b4-2d95-49ae-b9da-80b23d399236', 'status': 'complete', 'objects': [{'id': 'b9ea26b4-2d95-49ae-b9da-80b23d399236...
│ └ typing.Union[dap.dap_types.TableJob, dap.dap_types.CompleteSnapshotJob, dap.dap_types.CompleteIncrementalJob, dap.dap_types.F...
└ <function json_to_object at 0x128026b60>
File "/Users/asj18a/code/snowflake-extract-load/.venv/lib/python3.11/site-packages/strong_typing/serialization.py", line 76, in json_to_object
return parser.parse(data)
│ │ └ {'id': 'b9ea26b4-2d95-49ae-b9da-80b23d399236', 'status': 'complete', 'objects': [{'id': 'b9ea26b4-2d95-49ae-b9da-80b23d399236...
│ └ <function UnionDeserializer.parse at 0x12806eb60>
└ <strong_typing.deserializer.UnionDeserializer object at 0x128746250>
File "/Users/asj18a/code/snowflake-extract-load/.venv/lib/python3.11/site-packages/strong_typing/deserializer.py", line 389, in parse
raise JsonKeyError(
└ <class 'strong_typing.exception.JsonKeyError'>
strong_typing.exception.JsonKeyError: type `Union[TableJob, CompleteSnapshotJob, CompleteIncrementalJob, FailedJob]` could not be instantiated from: {'id': 'b9ea26b4-2d95-49ae-b9da-80b23d399236', 'status': 'complete', 'objects': [{'id':
'b9ea26b4-2d95-49ae-b9da-80b23d399236/part-00000-be049ff3-6f89-4e7b-9b10-c9d5562d7942-c000.gz.parquet'}], 'expires_at': '2025-03-19T18:46:33Z', 'at': '2025-03-18T15:10:19Z'}
As you can see, the job is successfully created, things seem to be working in the back end, but the logic to parse a CompleteSnapshotJob from the successful JSON payload is failing. This occurs with the conversion to both CompleteSnapshotJob and CompleteIncrementalJob. If there is anything else y'all need from me, please let me know.
Solved! Go to Solution.
Hey, there has been an incident that got resolved since: https://status.instructure.com/incidents/mhkszp5zx2bm
Same for us. Further, this error is intermittent. We can wait a bit and re-try, and the data is fetched appropriately. So I'm guessing this is a performance/throttling issue on the DAP/AWS side.
Weird! I was getting the error yesterday afternoon, and I just chalked it up to a lack of incremental changes, but I'm still getting the same error pretty regularly this morning. It being a performance issue would make sense though, I know they were having related issues a week or two ago.
Also getting the same error. Seems to be intermittent here as well, but not totally verified yet.
I'll outline my investigation, hopefully my theory isn't a wild goose chase.
I suspected this may be due to a recent update. Our old image (where we ran into the failure) was happening with DAP CLI version 1.3.1. Diffing `dap_types.py` (where this Union type is defined) for 1.3.1 against 1.4.0 (the newest version), there's no changes.
There _is_ a missing field in the response:
- `CompleteJob` has `objects` and `schema_version` attributes
- `CompleteIncrementalJob` (the type we should be unmarshalling here) inherits from `CompleteJob`
From the logs, `schema_version` doesn't seem to be present in the HTTP response coming from Instructure's DAP API.. at least sometimes?
Good info, thanks for sharing! It looks like the instructure staff might be on the same track, they just updated their status page saying there's an issue with malformed responses from Dap/job/{id}
Hey, there has been an incident that got resolved since: https://status.instructure.com/incidents/mhkszp5zx2bm
To participate in the Instructure Community, you need to sign up or log in:
Sign In