showReportDialog without eventId


#1

Hi,

I’m trying to use Sentry.showReportDialog() to provide a user feedback feature, even is there is no exception caught.

Manually triggering Sentry.showReportDialog() is triggering this error :
Uncaught Error: Missing `eventId` option in showReportDialog call at new SentryError

Is there a workaround ?


#2

Your have to have an event to go with it. You could generate one using captureMessage, but that may not be what you’re aiming for. If you wanted only event when feedback was submitted your likely have to render a form yourself and use our API. We’re not opposed to making this concept possible it just hasn’t been a focus for us.


#3

Today I came around the same problem (some months later) until I found this forum. I tried the following:

http POST <SELF_HOSTED_URL>/api/0/projects/<ORG_SLUG>/<PROJECT_SLUG>/user-feedback/ ‘Authorization: Bearer <TOKEN_WITH_ALL_PERMISSIONS>’ event_id=‘123453431asd’ name=‘TEST’ email=‘test@test.com’ comments=‘test’

HTTP/1.1 403 Forbidden
Allow: GET, POST, HEAD, OPTIONS
Content-Language: en
Content-Length: 64
Content-Type: application/json
Date: Fri, 01 Feb 2019 21:12:59 GMT
Vary: Accept-Encoding
Vary: Accept-Language, Cookie
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Xss-Protection: 1; mode=block

{
“detail”: “You do not have permission to perform this action.”
}

I setup my token with all the permissions and I am unable to POST. I am able to use GET and I can see the feedback. Is it possible to POST or not?’

I have the following permissions:

event:admin, event:read, member:read, org:read, project:read, project:releases, team:read, project:write, team:write, member:admin, project:admin, team:admin, org:write, org:admin


#4

I will answer this to myself.

You do not have permission to perform this action means that the user that created the token needs to be in a role of Admin, Manager or Owner. I would suggest using the minimum which is Admin (Admin < Manager < Owner).

The token created by the user, requires to have at least the following permissions:

project:write

I get the following response for this example:

curl -X POST $SENTRY_API/SENTRY_FEEDBACK -H "Content-Type: application/json" -d '{ "event_id" : "12sdfsd3121sdasd231", "user": "test2", "name" : "Test User", "comments" : "This is a simple test 2", "email" : "test2@test.com" }' -H "Authorization: Bearer {SENTRY_TOKEN}" | JQ

{
“eventID”: “12sdfsd3121sdasd231”,
“name”: “Test User”,
“event”: {
“eventID”: “12sdfsd3121sdasd231”,
“id”: null
},
“user”: null,
“dateCreated”: “2019-02-05T23:12:35.679Z”,
“issue”: null,
“id”: “1”,
“comments”: “This is a simple test 2”,
“email”: "test2@test.com"
}

The server doesn’t show anything. My first guess is that the event_id needs to be generated in the Sentry Server first and then it is possible to generate a Feedback message in the Sentry System. Is that correct? or am I doing something wrong?