http.Connection cache issue

We're using YouTrack 2022.1.46592, we have defined a workflow to send SMS to team leaders when a "Show-Stopper" issue is opened by the support team.

The problem is that when support opens a new issue - the SMS contains incorrect issue (just takes the previous "Show-Stopper" issue.

Testing the code - I narrowed it down to a cache issue within youtrack, so the following happens:

1. sending the sms directly from browser with different issue number - WORKS

2. creating a show stopper issue several times will send the first issue multiple times, although the print in the console is correct.

This is reproducible about 9/10 times.

I tried using POST/GET, random param to invalidate cache, no cache headers - all the same.

 

        var connection = new http.Connection(WEBHOOK_URL, null, 2000);
        connection.addHeader("Content-Type", "application/json");
        
        connection.addHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
        connection.addHeader("Pragma", "no-cache"); // HTTP 1.0.
        connection.addHeader("Expires", "0"); // Proxies.
        
        //connection.postSync('', null, JSON.stringify(payload));
        //connection.postSync('', queryParams, null);
        connection.getSync('', queryParams);
        connection=null;

Is this a know issue? is there a workaround?

Please advise.

3 comments
Comment actions Permalink

found a workaround - for some reason if our WEBHOOK_URL declared as global param - the cache issue happens.

Once i moved the param inside the func itself - the issue resolved.

0
Comment actions Permalink

Hi Pavel,

Thank you for the workaround, glad to hear the issue is resolved. I will try to reproduce the issues you mentioned and get back to you. 

0
Comment actions Permalink

Appreciate your patience. I wasn't able to reproduce the problem - the issue id was displayed correctly for me. If you'd like us to investigate the problem, would you mind creating a support request and sharing your full workflow code with us? Thank you.  

0

Please sign in to leave a comment.