-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 notification body is not valid anymore #14985
Comments
@dmzoneill looks like some fall out from the work you just did, mind taking a look? |
Thanks for your bug. It would be very helpful to see/understand your previous output. This check just makes sure that the body wasn't blank when generated by jinja. Furthermore, when you say it "fails to pass the block". What do you mean by it fails to pass the block? The exception lines you quoted are not related to the link you provided. https://github.com/ansible/awx/blob/23.9.0/awx/main/models/notifications.py#L462 Can you please clarify your bug request :) Many thanks
|
Hi, sorry for the lack of input, here are more informations. For a bit of context, the meaning of this webhook is to add text in a chat application. The example i've put in the description is like the one we are sending, and the format expected by the receiver: There are also some specific headers for authentication etc. We configure the notifications in AWX with the help of a playbook using the awx collection, if it can help, here is how it is defined in the playbook
what i mean by "it fails to pass the block", is that the condition is not successfull ( <= 2), so yes, i get the message :
Log example :
And here is a log example inside
Hope it helps to clarify the bug :-) |
ah okay, so this is helpful. I'll let in a fix to allow for just 1 line, i presume that's what's happening here. |
I'll get this merged ASAP. |
Another point: If the expected format is something like the following (telegram bot, for example):
the test will fail. However, sending a custom message associated with the template that follows the JSON structure above will work. |
Please confirm the following
security@ansible.com
instead.)Bug Summary
We are using notifications on start / fail / sucess of jobs.
This notifications are of type webhook, where the body contains the message and some values used by the recipient.
Body ex:
{"roomId": "my_room", "notificationText": "my_text"}
Since 23.9.0, those notifications does not work anymore, the logs show an http 400 response.
It fails to pass this block :
https://github.com/ansible/awx/blob/23.9.0/awx/main/models/notifications.py#L501-L510
The body containing only 1 line, it is considered as invalid.
This was working fine in 23.5.1
AWX version
23.9.0
Select the relevant components
Installation method
kubernetes
Modifications
no
Ansible version
2.15.9
Operating system
centos
Web browser
No response
Steps to reproduce
Use this kind of body:
{"roomId": "my_room", "notificationText": "my_text"}
Expected results
a notification is sent by AWX and received by the application at the other end.
Actual results
logs on awx-task:
Traceback (most recent call last): File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/tasks/system.py", line 346, in send_notifications sent = notification.notification_template.send(notification.subject, notification.body) File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/notifications.py", line 186, in send return backend_obj.send_messages([notification_obj]) File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/notifications/webhook_backend.py", line 119, in send_messages raise Exception(err) Exception: Error sending webhook notification: 400
when adding some logs there : https://github.com/ansible/awx/blob/23.9.0/awx/main/models/notifications.py#L501-L510
we can see the body does not match the condition.
Additional information
No response
The text was updated successfully, but these errors were encountered: