Closed jakubvojacek closed 2 years ago
@jakubvojacek thank you for the report! I'm not able to reproduce, could you please help me?
Do you see the same response for this API call if you open this page using Dev Tools?
Hello
I only see notification_policies
but its a OPTIONS, not a POST/GET request, therefore it has no preview response.
Please let me know what else should I check
@jakubvojacek that's already helpful, thank you! @maskin25 could you please check this one once you are back?
Hello @Matvey-Kuk @maskin25
have you been able to confirm that this is actually an issue yet, please? Not something wrong with my installation only?
Thanks Jakub
@jakubvojacek actually request OPTIONS /grafana-oncall-app/api/internal/v1/notification_policies/ should have a response (check it in response tab). Response should contain a wait_delay options as @Matvey-Kuk showed. Can you check actions.POST.wait_delay.choices
in response please?
It does not have any response, its blank, please check the curl below as well as screenshot from the network console
🐞 blujacker@~ $ curl 'https://xxxxxx/api/plugin-proxy/grafana-oncall-app/api/internal/v1/notification_policies/' \
> -X 'OPTIONS' \
> -H 'authority: xxxxxxx' \
> -H 'accept: application/json, text/plain, */*' \
> -H 'accept-language: cs,en;q=0.9,sk;q=0.8,en-US;q=0.7' \
> -H 'cookie: grafana_session=xxxxxx' \
> -H 'origin: https://xxxxxxx' \
> -H 'referer: https://xxxxxxx/monitoring-statistics/a/grafana-oncall-app/?page=incidents' \
> -H 'sec-ch-ua: "Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104"' \
> -H 'sec-ch-ua-mobile: ?0' \
> -H 'sec-ch-ua-platform: "macOS"' \
> -H 'sec-fetch-dest: empty' \
> -H 'sec-fetch-mode: cors' \
> -H 'sec-fetch-site: same-origin' \
> -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36' \
> -H 'x-oncall-plugin-version: v1.0.13' \
> --compressed
🐞 blujacker@~ $
hmmm interesting, it has response in my tests (see below) can you try it in other browser please, maybe your browser policies block this request
curl 'http://localhost:3000/api/plugin-proxy/grafana-oncall-app/api/internal/v1/notification_policies/' \
-X 'OPTIONS' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
-H 'Connection: keep-alive' \
-H 'Cookie: Pycharm-b0f5d2b5=e1ff86b8-152b-4b4e-a470-f93961b05827; csrftoken=dvAP8PklNLm19AYZ4WNDn3Owd6LgiKMbEW2RSrIhNuxkHYI1SN4E7Ba8AKwlwc7y; grafana_session=ad17e07975c418c63a0725a051607e3e' \
-H 'Origin: http://localhost:3000' \
-H 'Referer: http://localhost:3000/a/grafana-oncall-app/?page=escalations&id=FWHDG7UCBTHJR' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' \
-H 'X-OnCall-Plugin-Version: 1.0.0' \
-H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
--compressed
{"name":"User Notification Policy List","description":"","renders":["application/json","text/html"],"parses":["application/json","application/x-www-form-urlencoded","multipart/form-data"],"actions":{"POST":{"id":{"type":"string","required":false,"read_only":true,"label":"Id"},"step":{"type":"choice","required":false,"read_only":false,"label":"Step","choices":[{"value":0,"display_name":"Wait"},{"value":1,"display_name":"Notify by"}]},"order":{"type":"integer","required":false,"read_only":true,"label":"Order"},"notify_by":{"type":"choice","required":false,"read_only":false,"label":"Notify by","choices":[{"value":0,"display_name":0},{"value":1,"display_name":1},{"value":2,"display_name":2},{"value":3,"display_name":3},{"value":5,"display_name":5},{"value":6,"display_name":6}]},"wait_delay":{"type":"choice","required":false,"read_only":false,"label":"Wait delay","choices":[{"value":"60.0","display_name":"1 min"},{"value":"300.0","display_name":"5 min"},{"value":"900.0","display_name":"15 min"},{"value":"1800.0","display_name":"30 min"},{"value":"3600.0","display_name":"60 min"}]},"important":{"type":"boolean","required":false,"read_only":false,"label":"Important"},"user":{"type":"field","required":false,"read_only":false,"label":"User"},"prev_step":{"type":"string","required":false,"read_only":false,"label":"Prev step"}}}}
or maybe your browser modify request somehow, our CURLs are slightly differ
I tried safari and FF with same results only to realize that haproxy is to be blamed. I intercept OPTIONS request and return 200 or 500 with allowed options, something like
http-request return status 200 hdr access-control-allow-origin %[var(txn.origin)] hdr access-control-allow-methods "GET,POST,HEAD" hdr access-control-allow-headers "devicestype,profilesid,language,authorization,content-type,version,browsertype" hdr access-control-max-age 86400 if METH_OPTIONS
When I remove this line, it starts to work immediately.
I was under impression that OPTIONS requests should not return data?
Anyhow, I finally can select minutes, should I close this issue now?
@jakubvojacek thank you for raising the issue! Hope it will hope others who face similar problem.
and yes, you are right: according to specifications we should not use OPTIONS request here, it's better to use usual GET request, but actually it works
would it be possible to change to GET/POST in the future to comply with the specs?
@maskin25 what do you think, should we change that?
Hello
I am having trouble with editing the Wait delay (in minutes) on the edit escalation page. When I select the field, a dropdown opens with "No options found". I tried manually entering number into the textfield but after clicking outside of the element, it becomes empty again.
It might be related to My profile notification settings too. When I first installed on calll, I know my profile was created with Default notifications
But now I cannot select any action apart from message, phone, slack - I cannot select any option in the first selectbox. Attaching screenshot from both.
Could you please help me find out what might be the problem?