[TT-12323] fix panic when webhook handler is disabled#6334
Conversation
PR Reviewer Guide 🔍
|
|
API Changes --- prev.txt 2024-06-10 14:00:03.588701478 +0000
+++ current.txt 2024-06-10 14:00:00.288711149 +0000
@@ -7286,6 +7286,10 @@
a future version.
var (
+ // ErrEventHandlerDisabled is returned when the event handler is disabled.
+ ErrEventHandlerDisabled = errors.New("event handler disabled")
+)
+var (
ErrPoliciesFetchFailed = errors.New("fetch policies request login failure")
)
var ( |
PR Code Suggestions ✨
|
963c85e to
cad78ca
Compare
|
|
/release to release-5.4 |
|
/release to release-5.4.0 |
|
Working on it! Note that it can take a few minutes. |
### **User description** <!-- Provide a general summary of your changes in the Title above --> ## Description fix panic when webhook handler is disabled ## Related Issue https://tyktech.atlassian.net/browse/TT-12323 ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Bug fix, Tests ___ ### **Description** - Added error handling for when the webhook handler is disabled by introducing a new error variable `ErrEventHandlerDisabled`. - Modified the `Init` method in `WebHookHandler` to return the new error when the webhook is disabled. - Updated the corresponding test to check for the `ErrEventHandlerDisabled` error instead of no error. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks.go</strong><dd><code>Add error handling for disabled webhook handler</code> </dd></summary> <hr> gateway/event_handler_webhooks.go <li>Added error handling for disabled webhook handler.<br> <li> Introduced <code>ErrEventHandlerDisabled</code> error variable.<br> <li> Modified <code>Init</code> method to return <code>ErrEventHandlerDisabled</code> when webhook is <br>disabled.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-6587ad3f2629cfa6c84a71144127acd6cc7824e5141f0b4961848945a87e0198">+6/-1</a> </td> </tr> </table></td></tr><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks_test.go</strong><dd><code>Update test for disabled webhook handler error</code> </dd></summary> <hr> gateway/event_handler_webhooks_test.go - Updated test to check for `ErrEventHandlerDisabled` error. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-1a2f8d6ab4443031b0f8486809453f6389291a6f625745fe8c65ac5cdb0e9621">+1/-1</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions (cherry picked from commit 3e5963c)
|
@jeffy-mathew Succesfully merged PR |
|
Working on it! Note that it can take a few minutes. |
### **User description** <!-- Provide a general summary of your changes in the Title above --> ## Description fix panic when webhook handler is disabled ## Related Issue https://tyktech.atlassian.net/browse/TT-12323 ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Bug fix, Tests ___ ### **Description** - Added error handling for when the webhook handler is disabled by introducing a new error variable `ErrEventHandlerDisabled`. - Modified the `Init` method in `WebHookHandler` to return the new error when the webhook is disabled. - Updated the corresponding test to check for the `ErrEventHandlerDisabled` error instead of no error. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks.go</strong><dd><code>Add error handling for disabled webhook handler</code> </dd></summary> <hr> gateway/event_handler_webhooks.go <li>Added error handling for disabled webhook handler.<br> <li> Introduced <code>ErrEventHandlerDisabled</code> error variable.<br> <li> Modified <code>Init</code> method to return <code>ErrEventHandlerDisabled</code> when webhook is <br>disabled.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-6587ad3f2629cfa6c84a71144127acd6cc7824e5141f0b4961848945a87e0198">+6/-1</a> </td> </tr> </table></td></tr><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks_test.go</strong><dd><code>Update test for disabled webhook handler error</code> </dd></summary> <hr> gateway/event_handler_webhooks_test.go - Updated test to check for `ErrEventHandlerDisabled` error. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-1a2f8d6ab4443031b0f8486809453f6389291a6f625745fe8c65ac5cdb0e9621">+1/-1</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions (cherry picked from commit 3e5963c)
|
@jeffy-mathew Succesfully merged PR |
…s disabled (#6334) [TT-12323] fix panic when webhook handler is disabled (#6334) ### **User description** <!-- Provide a general summary of your changes in the Title above --> ## Description fix panic when webhook handler is disabled ## Related Issue https://tyktech.atlassian.net/browse/TT-12323 ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Bug fix, Tests ___ ### **Description** - Added error handling for when the webhook handler is disabled by introducing a new error variable `ErrEventHandlerDisabled`. - Modified the `Init` method in `WebHookHandler` to return the new error when the webhook is disabled. - Updated the corresponding test to check for the `ErrEventHandlerDisabled` error instead of no error. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks.go</strong><dd><code>Add error handling for disabled webhook handler</code> </dd></summary> <hr> gateway/event_handler_webhooks.go <li>Added error handling for disabled webhook handler.<br> <li> Introduced <code>ErrEventHandlerDisabled</code> error variable.<br> <li> Modified <code>Init</code> method to return <code>ErrEventHandlerDisabled</code> when webhook is <br>disabled.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-6587ad3f2629cfa6c84a71144127acd6cc7824e5141f0b4961848945a87e0198">+6/-1</a> </td> </tr> </table></td></tr><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks_test.go</strong><dd><code>Update test for disabled webhook handler error</code> </dd></summary> <hr> gateway/event_handler_webhooks_test.go - Updated test to check for `ErrEventHandlerDisabled` error. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-1a2f8d6ab4443031b0f8486809453f6389291a6f625745fe8c65ac5cdb0e9621">+1/-1</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
…disabled (#6334) [TT-12323] fix panic when webhook handler is disabled (#6334) ### **User description** <!-- Provide a general summary of your changes in the Title above --> ## Description fix panic when webhook handler is disabled ## Related Issue https://tyktech.atlassian.net/browse/TT-12323 ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Bug fix, Tests ___ ### **Description** - Added error handling for when the webhook handler is disabled by introducing a new error variable `ErrEventHandlerDisabled`. - Modified the `Init` method in `WebHookHandler` to return the new error when the webhook is disabled. - Updated the corresponding test to check for the `ErrEventHandlerDisabled` error instead of no error. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks.go</strong><dd><code>Add error handling for disabled webhook handler</code> </dd></summary> <hr> gateway/event_handler_webhooks.go <li>Added error handling for disabled webhook handler.<br> <li> Introduced <code>ErrEventHandlerDisabled</code> error variable.<br> <li> Modified <code>Init</code> method to return <code>ErrEventHandlerDisabled</code> when webhook is <br>disabled.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-6587ad3f2629cfa6c84a71144127acd6cc7824e5141f0b4961848945a87e0198">+6/-1</a> </td> </tr> </table></td></tr><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks_test.go</strong><dd><code>Update test for disabled webhook handler error</code> </dd></summary> <hr> gateway/event_handler_webhooks_test.go - Updated test to check for `ErrEventHandlerDisabled` error. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-1a2f8d6ab4443031b0f8486809453f6389291a6f625745fe8c65ac5cdb0e9621">+1/-1</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
### **User description** <!-- Provide a general summary of your changes in the Title above --> ## Description fix panic when webhook handler is disabled ## Related Issue https://tyktech.atlassian.net/browse/TT-12323 ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Bug fix, Tests ___ ### **Description** - Added error handling for when the webhook handler is disabled by introducing a new error variable `ErrEventHandlerDisabled`. - Modified the `Init` method in `WebHookHandler` to return the new error when the webhook is disabled. - Updated the corresponding test to check for the `ErrEventHandlerDisabled` error instead of no error. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks.go</strong><dd><code>Add error handling for disabled webhook handler</code> </dd></summary> <hr> gateway/event_handler_webhooks.go <li>Added error handling for disabled webhook handler.<br> <li> Introduced <code>ErrEventHandlerDisabled</code> error variable.<br> <li> Modified <code>Init</code> method to return <code>ErrEventHandlerDisabled</code> when webhook is <br>disabled.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-6587ad3f2629cfa6c84a71144127acd6cc7824e5141f0b4961848945a87e0198">+6/-1</a> </td> </tr> </table></td></tr><tr><td><strong>Tests </strong></td><td><table> <tr> <td> <details> <summary><strong>event_handler_webhooks_test.go</strong><dd><code>Update test for disabled webhook handler error</code> </dd></summary> <hr> gateway/event_handler_webhooks_test.go - Updated test to check for `ErrEventHandlerDisabled` error. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6334/files#diff-1a2f8d6ab4443031b0f8486809453f6389291a6f625745fe8c65ac5cdb0e9621">+1/-1</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions



User description
Description
fix panic when webhook handler is disabled
Related Issue
https://tyktech.atlassian.net/browse/TT-12323
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist
PR Type
Bug fix, Tests
Description
ErrEventHandlerDisabled.Initmethod inWebHookHandlerto return the new error when the webhook is disabled.ErrEventHandlerDisablederror instead of no error.Changes walkthrough 📝
event_handler_webhooks.go
Add error handling for disabled webhook handlergateway/event_handler_webhooks.go
ErrEventHandlerDisablederror variable.Initmethod to returnErrEventHandlerDisabledwhen webhook isdisabled.
event_handler_webhooks_test.go
Update test for disabled webhook handler errorgateway/event_handler_webhooks_test.go
ErrEventHandlerDisablederror.