letsencrypt-dcos icon indicating copy to clipboard operation
letsencrypt-dcos copied to clipboard

ValueError: No JSON object could be decoded

Open willwnekowicz opened this issue 9 years ago • 10 comments

When launching the container, it fails with:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/json/__init__.py", line 290, in load
    **kw)
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

willwnekowicz avatar Oct 29 '16 18:10 willwnekowicz

Is there any more context in the log? This isn't enough for me to even guess at what's happening.

brndnmtthws avatar Nov 18 '16 22:11 brndnmtthws

I have the same problem, and no more logs in the stack ;/

@brndnmtthws did you manage to resolve it?

sipsynergy avatar Feb 17 '17 17:02 sipsynergy

I haven't seen the problem myself, but I'll see what I can do.

brndnmtthws avatar Feb 17 '17 17:02 brndnmtthws

@brndnmtthws in my case that was being hooked to the wrong marathon api endpoint.

I had it pointed to marathon-user API end point, so python could not find the app id.

sipsynergy avatar Feb 17 '17 17:02 sipsynergy

false hopes.. still erroring in the same manner... and no certs... just app not crashing now.. :P

sipsynergy avatar Feb 17 '17 17:02 sipsynergy

This is my test if that helps:

command: curl -sLIv https://registry.xyz.co.uk 2>&1 | cat

  • Rebuilt URL to: https://registry.xyz.co.uk/
  • Hostname was NOT found in DNS cache
  • Trying 34.250.243.100...
  • Connected to registry.xyz.co.uk (34.250.243.105) port 443 (#0)
  • successfully set certificate verify locations:
  • CAfile: none CApath: /etc/ssl/certs
  • SSLv3, TLS handshake, Client hello (1): } [data not shown]
  • SSLv3, TLS alert, Client hello (1): { [data not shown]
  • SSLv3, TLS handshake, Server hello (2): { [data not shown]
  • SSLv3, TLS handshake, CERT (11): { [data not shown]
  • SSLv3, TLS alert, Server hello (2): } [data not shown]
  • SSL certificate problem: self signed certificate
  • Closing connection 0
  • SSLv3, TLS alert, Client hello (1): } [data not shown]

pawmart avatar Feb 17 '17 19:02 pawmart

The line of code that's failing is presumably here: https://github.com/mesosphere/letsencrypt-dcos/blob/master/run.sh#L8

Can you try running that line of code with your arguments set?

brndnmtthws avatar Feb 17 '17 19:02 brndnmtthws

OK, I am pretty sure I know what the problem is...

I have forked the repo and did some debugging... and managed to replicate this locally...

The error is shown when the response returns as non json (obvious from the error message too)..

tried locally with auth token and return was my domain name!

curl -s -H "Authorization: token=mytoken" http://xyz.eu-west-1.elb.amazonaws.com/service/marathon/v2/apps/letsencrypt-dcos | python -c 'import sys, json; print(json.load(sys.stdin)["app"]["labels"]["HAPROXY_0_VHOST"])'

So solution would be to provide a token within curl request. I think!

pawmart avatar Feb 18 '17 23:02 pawmart

Ah, you're using auth. I didn't bother to add auth support to this.

brndnmtthws avatar Feb 21 '17 19:02 brndnmtthws

I made a PR ;) would be good to consider this for merge so i am not using my forked version but default to main lib ;)

pawmart avatar Feb 21 '17 20:02 pawmart