Webhook Grafana Integration

Description

Since the migration in V2.2.1, integration from Grafana doesn’t works anymore.

Server Setup Information

  • Version of Rocket.Chat Server: 2.2.1
  • Operating System: Ubuntu 18.04
  • Deployment Method: tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: v8.16.1
  • MongoDB Version: 4.0.12
  • Proxy: nginx
  • Firewalls involved: Sophos

Any additional Information

20191128-16:32:29.802(1) server.js:204 Integrations ➔ Incoming WebHook.error [Error running Script in Trigger Grafana_IT :]
I20191128-16:32:29.803(1) server.js:204 Integrations ➔ Incoming WebHook.error var Script=function(){function Script(){}var _proto=Script.prototype;_proto.process_incoming_request=function process_incoming_request(_ref){var request=_ref.request;request.content.attachments.forEach(function(attachment){attachment.fields.forEach(function(field){field.value=field.value.toString()})});return request};return Script}();
I20191128-16:32:29.804(1) server.js:204 Integrations ➔ Incoming WebHook.error [Stack:]
I20191128-16:32:29.805(1) server.js:204 Integrations ➔ Incoming WebHook.error Error: TypeError: Cannot read property ‘forEach’ of undefined at Promise.catch (evalmachine.:11:33) at /opt/Rocket.Chat/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40

The script used is:

class Script {

process_incoming_request({ request }) {

    request.content.attachments.forEach(function (attachment) {
        attachment.fields.forEach(function (field) {
            field.value = field.value.toString();
        });
    });

    return request;

}

}

We’re using slack type notification in Grafana.

Thanks.