Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encountering 'invalid character' error While utilising PagerDuty 2.6.0 Integration #58

Open
dishi-singhal opened this issue Mar 13, 2024 · 0 comments
Assignees

Comments

@dishi-singhal
Copy link

Subject: While using pagerduty 2.6.0(https://github.com/sensu/sensu-pagerduty-handler/releases/tag/2.6.0), facing error: invalid character.

Context: While using event with the PagerDuty handler version 2.6.0 & annotations using the '--details-format json' parameter, an error involving 'invalid character' is consistently encountered. However, the event proceeds successfully when '--details-format string' is used instead.

  1. Example Command and Output with '--details-format string':
    cat event.json | ./pagerduty-handler -t *redacted* --details-format string --dedup-key-template "{{.Entity.Namespace}}-{{.Entity.Name}}-{{.Check.Name}}" --status-map "{\"info\":[0],\"warning\": [1],\"critical\": [2],\"error\": [3,127]}" --summary-template "[{{.Entity.Namespace}}] {{.Entity.Name}}/{{.Check.Name}}: {{.Check.State}}" --details-template "{{.Check.Output}}\n\n{{.Check}}"

Output:

2024/02/29 15:05:17 Incident severity: error
2024/02/29 15:05:17 Incident Summary: [default] ip-172-31-27-229/helloworld: failing
2024/02/29 15:05:18 Event (trigger) submitted to PagerDuty, Status: success, Dedup Key: default-ip-172-31-27-229-helloworld, Message: Event processed

This signifies that the event is successfully processed without encountering the error.

  1. Example Command and Output with '--details-format json':
    cat event.json | ./pagerduty-handler -t *redacted* --details-format json --dedup-key-template "{{.Entity.Namespace}}-{{.Entity.Name}}-{{.Check.Name}}" --status-map "{\"info\":[0],\"warning\": [1],\"critical\": [2],\"error\": [3,127]}" --summary-template "[{{.Entity.Namespace}}] {{.Entity.Name}}/{{.Check.Name}}: {{.Check.State}}" --details-template "{{.Check.Output}}\n\n{{.Check}}"

Output:

2024/02/29 15:04:53 Incident severity: error
2024/02/29 15:04:53 Incident Summary: [default] ip-172-31-27-229/helloworld: failing
Error executing sensu-pagerduty-handler: error executing handler: failed to unmarshal json details: invalid character 'e' looking for beginning of value

NOTE: The invalid character keeps on changing with 'e', '{', 'H' whenever we use different event.json. But the originally we faced the below error which was constant for a couple for time:
Error executing sensu-pagerduty-handler: error executing handler: failed to unmarshal json details: invalid character '\n' in string literal.

This signifies that the event is not passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants