-
Notifications
You must be signed in to change notification settings - Fork 104
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
Set message when building LegacyCustomWebhookMessage #670
Set message when building LegacyCustomWebhookMessage #670
Conversation
Signed-off-by: Petar Partlov <[email protected]>
@@ -260,7 +260,7 @@ data class Destination( | |||
} | |||
DestinationType.CUSTOM_WEBHOOK -> { | |||
destinationMessage = LegacyCustomWebhookMessage.Builder(name) | |||
.withUrl(getLegacyCustomWebhookMessageURL(customWebhook)) | |||
.withUrl(getLegacyCustomWebhookMessageURL(customWebhook, compiledMessage)) | |||
.withHeaderParams(customWebhook?.headerParams) | |||
.withMessage(compiledMessage).build() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message is passed in here. It's not required in getLegacyCustomWebhookMessageURL
since that method is only combining the individual URL parameters to a String to pass to withUrl
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see what you're saying. We're not setting message
in the builder and it's throwing an IllegalArgumentException
when we call build()
in getLegacyCustomWebhookMessageURL()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is correct. It is true that it is not required for actual construction of URI, but unfortunately it is required field of LegacyCustomWebhookMessage
and it always throws IllegalArgumentException("Message content is missing")
. I went with this solution as it is simple and this legacy destination is only used in limited number of cases (and it will probably be removed in some of future releases).
It would probably be best to completely separate URI construction code of constructing LegacyCustomWebhookMessage
object itself, but as message is available here I went with this easy fix.
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588)
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588)
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588)
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588)
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588)
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588)
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588) Co-authored-by: Petar Partlov <[email protected]>
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588) Co-authored-by: Petar Partlov <[email protected]>
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588) Co-authored-by: Petar Partlov <[email protected]>
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588) Co-authored-by: Petar Partlov <[email protected]>
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588) Co-authored-by: Petar Partlov <[email protected]>
Signed-off-by: Petar Partlov <[email protected]> Signed-off-by: Petar Partlov <[email protected]> (cherry picked from commit 9d9f588) Co-authored-by: Petar Partlov <[email protected]>
Signed-off-by: Petar Partlov [email protected]
Issue #, if available:
Description of changes:
While testing legacy destinations for custom webhooks I discovered issue which is 100% reproducible. Scope should not be huge as this can influence only users with some issue during migration of old legacy notification system to new which uses notification plugin.
Issue is that one of required field (message) was not set during building instance of LegacyCustomWebhookMessage object.
CheckList:
[ ] Commits are signed per the DCO using --signoff
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.