fix: return CallResource errors as HTTP responses instead of Go errors - #663
fix: return CallResource errors as HTTP responses instead of Go errors#663nhuisman-amz wants to merge 1 commit into
Conversation
|
@nhuisman-amz and @itsgareth - please ensure your commits are signed so we can merge this PR in 😊 |
|
hey, @nhuisman-amz sorry for the long wait time on this pr being merged, one final thing, can you please make sure all commits in this pr are signed, this is a blocking requirement before any pr can be merged. |
7bd428c to
f783fc1
Compare
signed commits |
…urning Go errors When CallResource endpoints (/databases, /tables, /measures, /dimensions) encounter errors, they returned Go errors directly. Grafana server treats returned errors as unhandled plugin failures and sanitizes them to a generic "plugin.downstreamError" HTTP 500, hiding actionable messages like AccessDeniedException from users. Add sendError() helper that sends errors as HTTP responses via sender.Send(), ensuring error messages reach the browser. This matches how CheckHealth already surfaces errors to users.
f783fc1 to
28ff991
Compare
Signed commits report1 of 1 commit between
This repository requires all commits to be signed. See GitHub docs on commit signature verification. |
|
@nhuisman-amz - my apologies, I rebased this since it had been a while and that's unverified the commit signatures, if you could please sign again I'll follow up and get this merged ASAP. |
Summary
Replace
return errwithsendError(sender, err)in allCallResourceerror paths so that downstream errors (e.g. IAMAccessDeniedException) are returned to the user as HTTP responses instead of being sanitized to a genericplugin.downstreamError.Fixes #662
Problem
When
CallResourceendpoints (/databases,/tables,/measures,/dimensions) encounter errors from the Timestream API, they return the error as a Goerror. Grafana server treats this as an unhandled plugin failure and returns a generic HTTP 500 withplugin.downstreamError, discarding the actual error message.Users see:
Instead of the actionable error:
Fix
Added a
sendError()helper that sends errors as HTTP responses viasender.Send(), and replaced all 5return errpaths inCallResource:This matches how
CheckHealthalready surfaces errors — by returning them as structured responses rather than Go errors.Affected endpoints
/databases— query error (1 path)/tables— unmarshal error, query error (2 paths)/measures— unmarshal error, query error (2 paths)/dimensions— shares the measures/dimensions block aboveTesting
go build ./pkg/timestream/passestimestream:ListMeasures— the measures dropdown now shows theAccessDeniedExceptionmessage instead of the generic error