Error while saving rule with Input Transformer: Invalid InputTemplate

1

I have set up CloudWatch rule that would post a message to SNS on CloudBuild project failure.
I wanted to use new Input Transformer feature to craft an email message based on JSON event data.
Here is a sample event:

{
  "version": "0",
  "id": "1cb6e284-2c0a-4b4d-95f2-7dc042733d11",
  "detail-type": "CodeBuild Build State Change",
  "source": "aws.codebuild",
  "account": "123456789012",
  "time": "2017-07-12T00:42:28Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:codebuild:us-east-1:123456789012:build/SampleProjectName:a68ca311-846f-4ca4-b606-ae36de59542b"
  ],
  "detail": {
    "build-status": "FAILED",
    "project-name": "SampleProjectName",
    "build-id": "arn:aws:codebuild:us-east-1:123456789012:build/SampleProjectName:a68ca311-846f-4ca4-b606-ae36de59542b",
    "current-phase": "COMPLETED",
    "current-phase-context": "[]",
    "version": "1"
  }
}

Here is my input path

{
  "project": "$.detail.project-name"
}

and input template

Build failed <project
>```

I'm getting the following error upon saving the rule  
-----  
There was an error while saving rule **failed-build**.  
Details: **Invalid InputTemplate for target Id38459876381764 : \\[Source: Build failed null; line: 1, column: 6\]..**  
  
Could you please share your events and templates and/or pinpoint an error in mine?
ma
gefragt vor 7 Jahren3331 Aufrufe
2 Antworten
1
Akzeptierte Antwort

Hi Ma,

You were seeing this error message because CWE rule only allows users to use a String (with double quotes)

"Build failed <project>"

or a JSON in the input template.

{
  "Build failed": <project>
}

Edited by: yongataws on Aug 8, 2017 10:25 AM

AWS
beantwortet vor 7 Jahren
0

Thank you, I've added the double quotes and it works now!

ma
beantwortet vor 7 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen