jooola / zabbix-matrix-webhook

GNU General Public License v3.0
34 stars 8 forks source link

"Invalid json at offset 1" #5

Closed otheus closed 3 years ago

otheus commented 3 years ago

Thanks for making this extension. On my initial setup, using our own Zabbix installation (5.0) and our own Matrix installation, I modified the media.json file with the version number of Zabbix, imported it successfully, went to our Matrix sever, created an account, got the user's token, pasted it into the new media type options/token field, created a new room, invited the user, then found the room internal id, pasted that in to the configuration, and tried to send a test message. GotSending failed: SyntaxError: invalid json (at offset 1)

Media type test log

00:00:00.001 [Debug] [Matrix Webhook] new request to: chat..xxxxxx./_matrix/client/r0/rooms/!UOyQbdnzmapvUDMvlY:uibk.ac.at/send/m.room.message

00:00:00.154 [Debug] [Matrix Webhook] Error: SyntaxError: invalid json (at offset 1)

Are there some sort of prerequisites?Is the URL path always the same?

jooola commented 3 years ago

The Matrix server might return something else than JSON, hence the invalid JSON error.

Maybe the server url is not properly set for your setup.

First thing on the top of my head, is that the URL in your logs is missing the protocol part (http or https).

I would need more information about your setup to find what is wrong.