alerta/alerta

Unable to create alerts - Input has too many columns

Opened this issue · 1 comments

Issue Summary
While trying to create alerts in Alerta we are getting this error
alerta.exceptions.ApiError: cannot cast type record to history
LINE 10: ...ULL, NULL, NULL, NULL, 31536000, NULL, NULL, 'no')::history]...

Environment

  • OS: Docker

  • API version: alerta/alerta-web:8.5.0

  • Deployment: Docker

  • Database: Docker --> Postgres:14-alpine

  • web UI version: alerta/alerta-web:8.5.0

To Reproduce
Steps to reproduce the behavior:
curl --location --request POST 'https://:/api/alert'
--header 'Content-Type: application/json'
--data-raw '{
"attributes": {
"region": "EU"
},
"correlate": [
"HttpServerError",
"HttpServerOK"
],
"environment": "Production",
"event": "HttpServerError",
"group": "Web",
"origin": "curl",
"resource": "web01",
"service": [
"example.com"
],
"severity": "critical",
"tags": [
"dc1"
],
"text": "Site is down.",
"type": "exceptionAlert",
"value": "Bad Gateway (501)"
}'

Expected behavior
Alert Gets Created

Actual behavior

DETAIL: Input has too many columns.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/venv/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "/venv/lib/python3.7/site-packages/flask_cors/decorator.py", line 128, in wrapped_function
resp = make_response(f(*args, **kwargs))
File "/venv/lib/python3.7/site-packages/alerta/auth/decorators.py", line 128, in wrapped
return f(*args, **kwargs)
File "/venv/lib/python3.7/site-packages/alerta/models/metrics.py", line 258, in wrapped
response = f(*args, **kwargs)
File "/venv/lib/python3.7/site-packages/alerta/utils/response.py", line 18, in decorated
return func(*args, **kwargs)
File "/venv/lib/python3.7/site-packages/alerta/views/alerts.py", line 71, in receive
raise ApiError(str(e), 500)
alerta.exceptions.ApiError: cannot cast type record to history
LINE 10: ...ULL, NULL, NULL, NULL, 31536000, NULL, NULL, 'no')::history]...
^
DETAIL: Input has too many columns.
2024-02-29 18:18:14,235 DEBG 'uwsgi' stdout output:
[pid: 65|app: 0|req: 4/31] 10.249.144.180 () {48 vars in 626 bytes} [Thu Feb 29 18:18:14 2024] POST /api/alert => generated 324 bytes in 46 msecs (HTTP/1.1 500) 5 headers in 204 bytes (2 switches on core 0)

Just a note, its works fine with Postgres:11.2-alpine but gives this error for Postgres:14-alpine