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

ref(sentry apps): Improve Sentry App Component endpoint errors #81167

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Christinarlong
Copy link
Contributor

@Christinarlong Christinarlong commented Nov 22, 2024

tl;dr Instead of returning a json with error: True return a json with error: "ValidationError: bruh"

Expose sentry app component endpoint errors. Instead of returning a boolean indicating that an error occurred while trying to make the component we return the error message.

Context for SentryAppComponents: Some SentryAppComponents will reach out to a specified URI to get dropdown options from. If the request to the URI fails, currently we catch the failure, raise an exception and in the SentryAppComponentEndpoint and append the component_uuid to an errors list. Then in the serializer we check the errors list to see if the serialized component's uuid is present and if so we set an error flag on the component to True. The frontend then reads the returned json and if the error flag is True, we disable the flagged component (grey out).

Tested all the errors & messages, but this can go in after broader changes to errors for SentryApps outlined here

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #81167      +/-   ##
==========================================
- Coverage   80.45%   80.37%   -0.09%     
==========================================
  Files        7241     7224      -17     
  Lines      321509   319645    -1864     
  Branches    20810    20755      -55     
==========================================
- Hits       258674   256907    -1767     
+ Misses      62436    62345      -91     
+ Partials      399      393       -6     

Christinarlong added a commit that referenced this pull request Dec 3, 2024
… errors (#81480)

In (#81167 ), we want to change the SentryAppComponent endpoint to
return a string of the error to improve end user clarity when debugging.
In the frontend, we currently expect the error response to be a boolean
though, so we need to make the frontend backwards compatible (i.e handle
both boolean and string)
@@ -14,7 +14,7 @@ def serialize(self, obj, attrs, user, **kwargs):
"uuid": str(obj.uuid),
"type": obj.type,
"schema": obj.schema,
"error": True if str(obj.uuid) in errors else False,
"error": errors.get(str(obj.uuid), ""),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the above we catch all errors (assuming they're raised), so there should never be the case where a component in in errors but the message is an empty string.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does it look like on the frontend when we return the entire error instead of a bool?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing will change for frontend appearance wise. Currently we use that boolean to determine whether or not we need to gray out the UI component and display a generic 'couldn't connect to [SentryApp]' message. That message and appearance will stay the same, the new errors will be exposed via the network requests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should that be a change we make -- to surface the more explicit error message?

Copy link
Contributor Author

@Christinarlong Christinarlong Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could, but that would be a future PR. Our integrators are all developers who will check the network reqs to debug cust issues, so this change is needed first to provide that visibility.

@Christinarlong Christinarlong marked this pull request as ready for review December 3, 2024 22:43
@Christinarlong Christinarlong requested review from a team as code owners December 3, 2024 22:43
Copy link
Member

@cathteng cathteng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to update API docs for this change?

@@ -14,7 +14,7 @@ def serialize(self, obj, attrs, user, **kwargs):
"uuid": str(obj.uuid),
"type": obj.type,
"schema": obj.schema,
"error": True if str(obj.uuid) in errors else False,
"error": errors.get(str(obj.uuid), ""),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should that be a change we make -- to surface the more explicit error message?

@Christinarlong
Copy link
Contributor Author

do we need to update API docs for this change?

ney this is a private endpoint

@getsantry
Copy link
Contributor

getsantry bot commented Dec 27, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Dec 27, 2024
andrewshie-sentry pushed a commit that referenced this pull request Jan 2, 2025
… errors (#81480)

In (#81167 ), we want to change the SentryAppComponent endpoint to
return a string of the error to improve end user clarity when debugging.
In the frontend, we currently expect the error response to be a boolean
though, so we need to make the frontend backwards compatible (i.e handle
both boolean and string)
@getsantry getsantry bot added the Stale label Jan 19, 2025
@getsantry
Copy link
Contributor

getsantry bot commented Jan 19, 2025

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot removed the Stale label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants