This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

Orquesta workflow tries to parse jinja inside json structure and fails. Error: expected token ':', got '}'

Hello,

I receive input for my workflow from an API containing JSON content. This JSON content does not contain valid Jinja expressions and I don’t want to parse any Jinja inside.
Nevertheless it looks like this is the default behaviour. Is there any possibility to not evaluate Jinja inside this JSON?

As example I created the following simplified test wfl for you:

version: 1.0

description: Parse error

vars:
  - test_in: {
          "md5": "93c8469e0ae544e3437a8762e35a48b2",
          "raw_headers": "X-Triage-Noise-Reduction: state=0
Subject: [EXT] +{{{{{ McAfee_SECURITY_SERVICE }}}}+
Thread-Topic: [EXT] +{{{{{ McAfee_SECURITY_SERVICE }}}}+
Thread-Index: AQHXU9CCsPPgqyQZN0Ort1HhdcR5dQ==
Date: Fri, 21 May 2021 13:48:06 +0000
...",
          "subject": "[EXT] +{{{{{ McAfee_SECURITY_SERVICE }}}}+",
          "processed_at": "2021-06-02T15:07:00.739Z"
        }

tasks:
  Testout:
    action: core.echo
    input:
      message: <% ctx().test_in.processed_at %>

Already during the parsing of the input value the wfl crashes with following error:

{
  "errors": [
    {
      "expression": "X-Triage-Noise-Reduction: state=0 Subject: [EXT] +{{{{{ McAfee_SECURITY_SERVICE }}}}+ Thread-Topic: [EXT] +{{{{{ McAfee_SECURITY_SERVICE }}}}+ Thread-Index: AQHXU9CCsPPgqyQZN0Ort1HhdcR5dQ== Date: Fri, 21 May 2021 13:48:06 +0000 ...",
      "message": "expected token ':', got '}'",
      "spec_path": "vars",
      "schema_path": "properties.vars",
      "language": "jinja",
      "type": "expression"
    },
    {
      "expression": "[EXT] +{{{{{ McAfee_SECURITY_SERVICE }}}}+",
      "message": "expected token ':', got '}'",
      "spec_path": "vars",
      "schema_path": "properties.vars",
      "language": "jinja",
      "type": "expression"
    }
  ],
  "output": null
}

In my real world example the test_in content is part of a more complex structure and I don’t see any possibility to escape this characters or something like this.

Any idea how to solve this issue are welcome.

Thanks.
Nikolas

Might be unrelated but is it the mismatch between the opening brace (5 times) vs closing are 4?
Is it auto-generated somewhere where you may not have control over how it is built?

We do use webhook trigger based rule where we pass {something} in the json and that does work in the rule processor. However, I could not when I had it {{something}} as it may be taken as jinja syntax!

not sure if it is the mismatch or if it already occurs when there are two or more braces. Nevertheless I can not influence the source. It is part of an email analysis workflow and it receives the message subject as it is in the mail given. In this case the subject contains 5 times { and 4 times }. There is no intention to be jinja syntax it is just by coincidence.