question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to parse response from streaming client

See original GitHub issue

Code Sample


ingestion_properties = IngestionProperties(
    database="MyDB",
    table="MyTable",
    dataFormat=DataFormat.MULTIJSON,
    reportLevel=ReportLevel.FailuresAndSuccesses,
    ingestionMappingReference="TestMapping"
)

data = [{}, {}, ..., {}] # list of dicts
stream = BytesIO("\n".join([json.dumps(d) for d in data]).encode("utf-8"))

client.ingest_from_stream(stream, ingestion_properties=ingestion_properties)

Problem description

Ingestion is failing for some reason but why is hard to debug since the response coming from the API is not able to be parsed as a JSON.

Traceback

  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\azure\kusto\ingest\_streaming_ingest_client.py", line 112, in ingest_from_stream
    mapping_name=ingestion_properties.ingestion_mapping_reference,
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\azure\kusto\data\request.py", line 434, in execute_streaming_ingest
    self._execute(endpoint, database, None, stream, KustoClient._streaming_ingest_default_timeout, properties)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\azure\kusto\data\request.py", line 478, in _execute
    raise KustoServiceError([response.json()], response)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\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)

Output of pip freeze

adal==1.2.2 astroid==2.3.2 attrs==19.3.0 azure-common==1.1.23 azure-core==1.0.0 azure-functions==1.0.5 azure-kusto-data==0.0.38 azure-kusto-ingest==0.0.38 azure-storage-blob==2.1.0 azure-storage-common==2.1.0 azure-storage-queue==2.1.0 backcall==0.1.0 bleach==3.1.0 certifi==2019.9.11 cffi==1.13.1 chardet==3.0.4 colorama==0.4.1 cryptography==2.8 cycler==0.10.0 decorator==4.4.0 defusedxml==0.6.0 entrypoints==0.3 fastavro==0.22.7 filelock==3.0.12 idna==2.8 importlib-metadata==0.23 ipykernel==5.1.3 ipython==7.8.0 ipython-genutils==0.2.0 ipywidgets==7.5.1 isodate==0.6.0 isort==4.3.21 jedi==0.15.1 Jinja2==2.10.3 jsonschema==3.1.1 jupyter==1.0.0 jupyter-client==5.3.4 jupyter-console==6.0.0 jupyter-core==4.6.0 jupyterthemes==0.20.0 kiwisolver==1.1.0 lazy-object-proxy==1.4.2 lesscpy==0.13.0 MarkupSafe==1.1.1 matplotlib==3.1.1 mccabe==0.6.1 memory-profiler==0.55.0 mistune==0.8.4 more-itertools==7.2.0 msrest==0.6.10 nbconvert==5.6.0 nbformat==4.4.0 notebook==6.0.1 numpy==1.17.3 oauthlib==3.1.0 packaging==19.2 pandocfilters==1.4.2 parso==0.5.1 pickleshare==0.7.5 pipenv==2018.11.26 pluggy==0.13.0 ply==3.11 prometheus-client==0.7.1 prompt-toolkit==2.0.10 psutil==5.6.3 psycopg2==2.8.4 py==1.8.0 pycparser==2.19 Pygments==2.4.2 PyJWT==1.7.1 pylint==2.4.3 pyparsing==2.4.2 pyrsistent==0.15.4 python-dateutil==2.8.0 pywin32==225 pywinpty==0.5.5 pyzmq==18.1.0 qtconsole==4.5.5 requests==2.22.0 requests-oauthlib==1.2.0 Send2Trash==1.5.0 six==1.12.0 terminado==0.8.2 testpath==0.4.2 toml==0.10.0 tornado==6.0.3 tox==3.14.0 traitlets==4.3.3 typed-ast==1.4.0 urllib3==1.25.6 virtualenv==16.7.5 virtualenv-clone==0.5.3 wcwidth==0.1.7 webencodings==0.5.1 widgetsnbextension==3.5.1 wrapt==1.11.2 zipp==0.6.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
ArielYehezkelycommented, Dec 3, 2019

Hi @cjbackman,

You can mail me at aryehezk@microsoft.com. Please attach your cluster details and code sample which generates the error.

Thanks, Ariel

0reactions
ArielYehezkelycommented, Dec 5, 2019

For the record:

  1. Streaming ingest is used to ingest small amounts of data where there’s a need of low latency query operations - in most cases ingest_client is the preferred way to ingest data.
  2. Streaming ingest should be enabled before using the SDK. Trying to use the SDK without prior cluster setup would generate an 404 error.
  3. As mentioned before, streaming ingest works against the engine and the service name is <cluster_name>.<region> and not ingest-<cluster_name>.<region> as the ingest_client use.

To learn more about streaming ingest and how to enable it, see the docs

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to parse response. Reason: Failed to read data from ...
if I start the Backup Manager, I get this error: Internal error: Failed to parse response. Reason: Failed to read data from stream...
Read more >
"Failed to parse server response" when using Google ...
I've created a bidirectional stream with assistant.converse() , and sending audio is successful. const assistant = new protocol.
Read more >
Troubleshooting Streaming - Oracle Help Center
This error is related to the client. The Streaming service doesn't send it, which means that the request never made it to the...
Read more >
[SOLVED] API client generated from OpenAPI spec is unable ...
[SOLVED] API client generated from OpenAPI spec is unable to parse response ... ApiException: Could not deserialize the response body stream as MyNameSpace....
Read more >
Attempting to login using lsclient throws an error message ...
"error" : "Unable to parse response JSON of all clients. ... However, the error message is keeping coming while listing client id or ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found