singer-io / tap-harvest

A Singer tap for extracting data from the Harvest API
GNU Affero General Public License v3.0
8 stars 13 forks source link

'User' error syncing through Stitchdata #25

Closed tom-mullen closed 6 years ago

tom-mullen commented 6 years ago

Steps:

Error 'User' occurs:

57Z   main - INFO State update: adding estimate_item_categories = "2015-05-11T13:23:48.000000Z"
2018-09-18 15:22:55,002Z    tap - CRITICAL 'user'
2018-09-18 15:22:55,004Z    tap - Traceback (most recent call last):
2018-09-18 15:22:55,004Z    tap -   File "tap-env/bin/tap-harvest", line 11, in <module>
2018-09-18 15:22:55,004Z    tap -     sys.exit(main())
2018-09-18 15:22:55,004Z    tap -   File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_harvest/__init__.py", line 478, in main
2018-09-18 15:22:55,004Z    tap -     raise exc
2018-09-18 15:22:55,004Z    tap -   File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_harvest/__init__.py", line 475, in main
2018-09-18 15:22:55,004Z    tap -     main_impl()
2018-09-18 15:22:55,004Z    tap -   File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_harvest/__init__.py", line 470, in main_impl
2018-09-18 15:22:55,004Z    tap -     do_sync()
2018-09-18 15:22:55,004Z    tap -   File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_harvest/__init__.py", line 454, in do_sync
2018-09-18 15:22:55,004Z    tap -     sync_estimates()
2018-09-18 15:22:55,004Z    tap -   File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_harvest/__init__.py", line 338, in sync_estimates
2018-09-18 15:22:55,004Z    tap -     object_to_id=['client', 'user'])
2018-09-18 15:22:55,005Z    tap -   File "/code/orchestrator/tap-env/lib/python3.5/site-packages/tap_harvest/__init__.py", line 199, in sync_endpoint
2018-09-18 15:22:55,005Z    tap -     if row[key] is not None:
2018-09-18 15:22:55,005Z    tap - KeyError: 'user'
2018-09-18 15:22:55,050Z target - INFO Exiting normally
2018-09-18 15:22:55,082Z   main - INFO Target exited normally with status 0
2018-09-18 15:22:55,085Z   main - INFO Exit status is: Tap failed with code 1 and error message: "'user'". Target succeeded.
KAllan357 commented 6 years ago

@tom-mullen thanks for the report. I think this is a simple change to make on line 199 there - we should just use Python's Dict get method to safely make the call here. Would you be willing to take that on?

dmosorast commented 6 years ago

Addressed in #26 and released in 2.0.5