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.

_stream_helper returns invalid JSON or cannot decode

See original GitHub issue

docker-py 1.8.0

python 3.5.0

docker Version 1.11.1-beta10 (build: 6662)

OS Mac OS X 10.11 Beta 15A279b


While using https://github.com/6si/shipwright, I found that invalid JSON was being returned by docker-py. According to the docs, the output of client.build should be an iterable of valid JSON objects encoded as strings (or the JSON objects decoded if decode=True is passed). e.g.

'{"stream":"Step 1 : FROM ubuntu:xenial\\n"}'

However, I have found while using the setup listed above, that it is returning strings like:

'{"stream":"Step 1 : FROM ubuntu:xenial\\n"}\r\n{"stream":"Step 2 : COPY foo\\n"}\r\n'

(Note the trailing CRLFs as well, differs from the documentation)

I suspect this issue is being triggered by the Docker side of things, it looks like the chunks in the chunked response used to align exactly with JSON objects, but now no longer do, although I’m not familiar enough with the Docker API to know if this is correct.

I also suspect I reached this issue because of the pre-release Docker installation, however I see that docker-py doesn’t list compatible Docker versions, which makes it difficult to know if this is a bug or unimplemented functionality.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:18

github_iconTop GitHub Comments

2reactions
shin-commented, Sep 9, 2016

1.10.0 is now available on pypi.

1reaction
robbiet480commented, Aug 23, 2016

This is still an issue for me as well (I’m having this in Ansible’s docker_image module and got here through ansible/ansible-modules-core#4116 and then #4116).

The fix proposed in #1081 works perfectly for me. I suggest that gets merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught Error: You're trying to decode an invalid JSON String
Error is on Ajax success or failure function. You are trying to decode invalid json which is passed from your controller (or middle...
Read more >
38547 (REST-API Json decode error will not give back an error)
In 39109: REST API: Return error when JSON decoding fails. If you send a request to the REST API with invalid JSON in...
Read more >
Codable: Can't Parse JSON File Swi… - Apple Developer
I am trying to parse a JSON file that has this structure: Code Block. {. "species":[. {. "name":"Aglais io",. "info": {. "family":"Nymphalidae",.
Read more >
Ignoring invalid JSON elements when using Codable
How elements containing missing or invalid data can be automatically ignored when using Swift's Codable API to parse JSON.
Read more >
How to Fix the Invalid JSON Error in WordPress? - YouTube
... try restarting your device. Your browser can't play this video. ... The response is not a valid JSON response“? To fix this...
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