When running iris in combination with uwsgi (e.g with the container image), the applications are not properly loaded at startup, leading to 401 errrors when using the webhooks api. Once the applications are fully loaded (e.g. by open iris ui with a web browser), the authentication error goes away without modifying the api call.
Steps to reproduce:
clone the master branch of the repo
docker-compose build && docker-compose up -d
Try to post alertmanager data on the webhook api
curl -v -X POST -d @prom-alert.json 'http://localhost:16649/v0/webhooks/alertmanager?application=oncall&key=magic'
Will return HTTP/401: {"title":"Authentication failure","description":"Application not found"}
Open Iris UI in a browser and login: http://localhost:16649 with demo/any password
or call the application api endpoint: curl -v http://localhost:16649/v0/applications
Try again the post the same alertmanager data on the api webhook again
curl -v -X POST -d @prom-alert.json 'http://localhost:16649/v0/webhooks/alertmanager?application=oncall&key=magic'
The incident is properly created and return HTTP/1.1 201 Created
When running iris in combination with uwsgi (e.g with the container image), the applications are not properly loaded at startup, leading to 401 errrors when using the webhooks api. Once the applications are fully loaded (e.g. by open iris ui with a web browser), the authentication error goes away without modifying the api call.
Steps to reproduce:
docker-compose build && docker-compose up -d
curl -v -X POST -d @prom-alert.json 'http://localhost:16649/v0/webhooks/alertmanager?application=oncall&key=magic'
{"title":"Authentication failure","description":"Application not found"}
http://localhost:16649
with demo/any passwordcurl -v http://localhost:16649/v0/applications
curl -v -X POST -d @prom-alert.json 'http://localhost:16649/v0/webhooks/alertmanager?application=oncall&key=magic'
HTTP/1.1 201 Created
Some additional logging information: I've modified https://github.com/linkedin/iris/blob/master/src/iris/cache.py#L52 to print when the applications are loaded.
uwsgi error log:
uwsgi access log:
This looks like the application cache is not properly populated on startup of the application.
I wasn't able to reproduce the issue with a local setup with gunicorn.
Used Sample Data