softdevteam / mattermost-github-integration

GitHub integration for Mattermost
Other
79 stars 50 forks source link

No JSON object could be decoded #48

Closed bensig closed 5 years ago

bensig commented 5 years ago

Getting this error when I test the plugin - any ideas?

[2018-10-12 09:58:51,671] ERROR in app: Exception on / [POST] Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "/root/src/mattermost-github-integration/mattermostgithub/server.py", line 110, in root post(msg, url, channel) File "/root/src/mattermost-github-integration/mattermostgithub/server.py", line 128, in post print('Encountered error posting to Mattermost URL %s, status=%d, response_body=%s' % (url, r.status_code, r.json())) File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 866, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python2.7/json/init.py", line 339, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

ptersilie commented 5 years ago

It looks like the plugin couldn't send the payload to your mattermost server (check that the URLs in the config are correct). Usually you should get an error message, but printing the error message failed, possibly due to your server returning 204 (No Content).

Try replacing Line 120 in mattermostgithub/server.py with

print('Encountered error posting to Mattermost URL %s, status=%d' % (url, r.status_code))

and resend the github payload. You should then get an error message that hopefully tells you more.

bensig commented 5 years ago

This is running on the same server, should I just send to localhost:port ? On Wed, Oct 17, 2018 at 7:06 AM Lukas Diekmann notifications@github.com wrote:

It looks like the plugin couldn't send the payload to your mattermost server (check that the URLs in the config are correct). Usually you should get an error message, but printing the error message failed, possibly due to your server returning 204 (No Content).

Try replacing Line 120 in mattermostgithub/server.py with

print('Encountered error posting to Mattermost URL %s, status=%d' % (url, r.status_code))

and resend the github payload. You should then get an error message that hopefully tells you more.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/softdevteam/mattermost-github-integration/issues/48#issuecomment-430642558, or mute the thread https://github.com/notifications/unsubscribe-auth/AByRChIcjCQU5bCTh4cdpi9ROWC-9EGQks5ulzl0gaJpZM4XZK2G .

ptersilie commented 5 years ago

Not necessarily. I'm using full URLS as well similar to this:

MATTERMOST_WEBHOOK_URLS = {
    'default' : ("https://MATTERMOSTSERVER/hooks/HOOKID", "notifications"),
}

I would try editing line 120 as described above and see what error you get.

ptersilie commented 5 years ago

@bensig Did you manage to solve your issue or do you need more help?

bensig commented 5 years ago

I'll test it out and get back to you, thanks for the follow-up.