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

Webhook Channel - Validate Request Body Template on save #258

Open
martialblog opened this issue Jul 25, 2024 · 2 comments
Open

Webhook Channel - Validate Request Body Template on save #258

martialblog opened this issue Jul 25, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@martialblog
Copy link
Member

Would be cool if invalid Request Body Templates are rejected before using them

Request Body Template: {{ is accepted, but then:

2024-07-25T09:33:45.401Z	ERROR	incident	Failed to send notification via channel plugin	{"object": "icinga.vagrant!SomeURL", "incident": "#17", "type": "webhook", "error": "plugin could not be started"}
2024-07-25T09:33:45.402Z	ERROR	channel	Failed to set channel plugin config, terminating the plugin	{"id": 2, "name": "Captain Hook", "error": "failed to set plugin config: cannot parse Request Body template: template: request_body:1: unclosed action"}

Which only shows up in the logs, when something needs to be sent not before.
There is no way to see my mistakes in the WebUI, which could be helpful when customizing the template.

Also there should be documentation on the template language, it uses Golang's text/template if I'm not mistaken? Should be mentioned in the docs how I can edit the request body.

@julianbrost
Copy link
Collaborator

That's limited due to the design of the system, the web frontend just writes the config you entered to the database, it doesn't really have the means to validate that config by itself. Additionally, currently all communication happens over the SQL database, I doubt we would want to implement some kind of RPC to validate config over that. So probably the best we could do here would be to asynchronously show that the channel is in an error state.

@oxzi What are you planning to do here as you assigned it to yourself?

@oxzi oxzi removed their assignment Jul 26, 2024
@oxzi
Copy link
Member

oxzi commented Jul 26, 2024

Tbh, I wasn't planning to assign me for this issue. I must have clicked incorrectly.

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

No branches or pull requests

3 participants