Skip to content

[Alerts] unable to use a context variable with an embedded newline in a webhook action #79371

@pmuellr

Description

@pmuellr

Working with a customer, and though I don't know for sure this is their problem, feels like it probably is.

They are using a webhook action, with a JSON mustache template, that works in one case, but when they add an additional context variable to one of the property values in the JSON, they are getting a 500 response from the service they are calling.

My guess is the variable contains a " character. If so, it would end up rendering invalid JSON.

Eg,

template: {"foo": "{{context.bar}}"}

if context.bar evaluates to the string xyz, the result of rendering the template will be {"foo": "xyz"}, which is fine.

if context.bar evaluates to the string x"z, the result of rendering the template will be {"foo": "x"z"}, which is no longer valid JSON, and won't be usable in any webhook expecting JSON.

I don't know of any work-around for this ATM, nor am I sure how we can make fixes to make this work, given the way the mustache templating currently works with alert params.

Metadata

Metadata

Assignees

Labels

Feature:AlertingR&DResearch and development ticket (not meant to produce code, but to make a decision)Team:ResponseOpsPlatform ResponseOps team (formerly the Cases and Alerting teams) t//

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions