Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alerting: crashes on old alerts #96040

Closed
lukasz-leszczuk-airspace-intelligence opened this issue Nov 7, 2024 · 1 comment · Fixed by #96085
Closed

Alerting: crashes on old alerts #96040

lukasz-leszczuk-airspace-intelligence opened this issue Nov 7, 2024 · 1 comment · Fixed by #96085

Comments

@lukasz-leszczuk-airspace-intelligence

What happened?

After upgrading to grafana 11.3.0 I can't open alert definition in grafana and I only get "An unexpected error happened" error message.
Since #93057 was merged, frontend code overrides uid field on datasource. But sometimes, with older alerts (successfully created via API in grafana 11.2.0), datasource is a string. So calling datasource.uid on a string raises an exception:

2react-dom.production.min.js:189 TypeError: Cannot create property 'uid' on string '<datasource name>'
    at M (QueryWrapper.tsx:101:34)
    at el (react-dom.production.min.js:167:137)
    at Rf (react-dom.production.min.js:290:337)
    at Cf (react-dom.production.min.js:280:389)
    at Qf (react-dom.production.min.js:280:320)
    at Cl (react-dom.production.min.js:280:180)
    at bc (react-dom.production.min.js:271:88)
    at Ef (react-dom.production.min.js:273:300)
    at Ls (react-dom.production.min.js:127:105)
    at react-dom.production.min.js:267:273

I believe the correct code in QueryWrapper.tsx should be like this:

queryWithDefaults.datasource = {}
queryWithDefaults.datasource.uid = query.datasourceUid;

What did you expect to happen?

Editor view presented with all details.

Did this work before?

Yes, in 11.2.0

How do we reproduce it?

Is the bug inside a dashboard panel?

No response

Environment (with versions)?

Grafana:
OS:
Browser:

Grafana platform?

None

Datasource(s)?

No response

@soniaAguilarPeiron
Copy link
Member

PR created with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants