[MGNLHOOK-288] Ensure webhook events are sent properly for the user's active environment on SaaS Created: 04/Nov/22  Updated: 20/Dec/22  Resolved: 20/Dec/22

Status: Closed
Project: Magnolia Webhooks
Component/s: None
Affects Version/s: 2.0.0
Fix Version/s: 2.0.0

Type: Bug Priority: Neutral
Reporter: Javier Benito Assignee: Javier Benito
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLHOOK-297 Implement fix Technical task Completed Javier Benito  
MGNLHOOK-298 Review Technical task Completed Milan Divilek  
MGNLHOOK-299 Pre-Integration QA Technical task Completed Milan Divilek  
MGNLHOOK-300 QA Technical task Completed Robert Šiška  
Team: DeveloperX
Date of First Response:
Epic Link: SaaS TPR - DevX Bugs
Sprint: DevX 25, DevX 26
Story Points: 3

 Description   

Current behaviour

Having some webhook events configured on a light module on:

  • main environment
  • test1 environment

If we switch the active environment from main to test1main environment events are still triggered, and test1 environment events are not triggered.

Expected behaviour

Webhook events must be triggered properly, depending on the active environment.

 



 Comments   
Comment by Christopher Zimmermann [ 07/Nov/22 ]

There are also use cases where we would want webhooks to fire on other environments. For example on a "UAT" environment, you may want to trigger builds - and also pointing to a different location. For example on Netlify - you have 2 projects. One for PROD and one for UAT.

So I think this needs more thought. But maybe at launch we could limit it to 'main'.

Comment by Javier Benito [ 07/Nov/22 ]

That use case (UAT) makes sense and makes me think if it's worth to limit now that only main environment triggers events, to remove that limitation later. Maybe it's better to address now that every environment fires the right events, instead of limiting the events only to main. What do you think?

Comment by Christopher Zimmermann [ 07/Nov/22 ]

For me it would be ok to leave it as is - active on all branches. But we should document it. 

I guess once we introduce Content Environments, this will be resolved as an environments webhook will only fire when the content in its environment is changed.

Comment by Javier Benito [ 07/Nov/22 ]

Yes, now it should work in the way you say - enabled in all environments, but there is a bug doing the following sequence:

  • Configure a webhook event on main environment -> it's triggered and works properly.
  • Change to other environment which does not have any webhook event configured -> previous webhook is still triggered in this environment.

So in my opinion, we should fix that bug, or implement this restriction - only main environment triggers webhook events. I'd say we need to address both, but not sure about the order. I thought we could address both in this ticket, but maybe it's better to split it into two.

 

Comment by Christopher Zimmermann [ 14/Nov/22 ]

jbenito I would change the expected behavour to the following, do you agree:

Only the webhooks configured in the users active environment should be "caught" and sent. For examplle: if the user is environment "test1", then only webhooks configured in the "test1" environment should detect changes and make requests. 

Comment by Javier Benito [ 14/Nov/22 ]

I do agree. Should we create a different ticket to address that only main environment should trigger events or we're not going to implement that restriction in the beginning?

 

In any case, I've changed this ticket description to reflect what actually happens.

Comment by Christopher Zimmermann [ 01/Dec/22 ]

No, I don't think we should have a ticket that only the main environment should trigger events.

I’d say that developers can have a webhook definition file for production env (ie main), and other different definition files for testing, staging, qa, whatever environments they have, targetting different endpoints than main. And that can be accomplished now just ensuring that each environment fires the proper webhooks.

Just as one example - as a devloper I am working on a feature on 'env/my-ssg' branch - I'd like to test webhooks on that environment.. but I dont waant publish actions on main (production) to be firing already... im still just developing the whole thing on 'env/my-ssg'
cc:  oanh.thai chuong.doan 

Comment by Javier Benito [ 01/Dec/22 ]

Understood

Comment by Oanh Thai Hoang [ 02/Dec/22 ]

Understood. Thank you czimmermann , jbenito .

Generated at Mon Feb 12 10:02:48 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.