Closed kkflie closed 7 months ago
Do other actions that rely on an org auth token work?
Do other actions that rely on an org auth token work?
@azaslavsky I have a Spring Boot project integrated with Sentry, which allows me to pinpoint errors back to the source code. It works well with the organization token.
@azaslavsky Hi, in the self-hosted Sentry, I added a URL pointing to my own Sentry address in ~/.sentryclirc under [default], and then changed the token under [auth] to User Auth Token. Now the token has permissions, but it shows [missing context line].
Is there a way to map errors back to the source code?
full DEBUG output:
sentry-cli sourcemaps --org sentry --project dms-frontend explain 34e0c4acf5294e9d9d1ae532bbe11705 --log-level=debug INFO 2024-02-23 14:12:30.113545 +08:00 Loaded config from /Users/gyb/.sentryclirc DEBUG 2024-02-23 14:12:30.114131 +08:00 sentry-cli version: 2.28.6, platform: "darwin", architecture: "arm64" INFO 2024-02-23 14:12:30.114910 +08:00 sentry-cli was invoked with the following command line: "/Users/gyb/.nvm/versions/node/v21.4.0/lib/node_modules/@sentry/cli/node_modules/@sentry/cli-darwin/bin/sentry-cli" "sourcemaps" "--org" "sentry" "--project" "dms-frontend" "explain" "34e0c4acf5294e9d9d1ae532bbe11705" "--log-level=debug" ⚠ DEPRECATION:
sourcemaps explain
has drifted from how sourcemap processing actually operates and its output may not be accurate. It will be removed in a future version ofsentry-cli
. DEBUG 2024-02-23 14:12:30.115877 +08:00 request GET https://sentry.hctcchina.com/api/0/projects/sentry/dms-frontend/events/34e0c4acf5294e9d9d1ae532bbe11705/json/ DEBUG 2024-02-23 14:12:30.115919 +08:00 using token authentication DEBUG 2024-02-23 14:12:30.116541 +08:00 retry number 0, max retries: 0 DEBUG 2024-02-23 14:12:30.122188 +08:00 > CONNECT sentry.hctcchina.com:443 HTTP/1.1 DEBUG 2024-02-23 14:12:30.122196 +08:00 > Host: sentry.hctcchina.com:443 DEBUG 2024-02-23 14:12:30.122199 +08:00 > Proxy-Connection: Keep-Alive DEBUG 2024-02-23 14:12:30.122265 +08:00 < HTTP/1.1 200 Connection established DEBUG 2024-02-23 14:12:30.224224 +08:00 > GET /api/0/projects/sentry/dms-frontend/events/34e0c4acf5294e9d9d1ae532bbe11705/json/ HTTP/1.1 DEBUG 2024-02-23 14:12:30.224247 +08:00 > Host: sentry.hctcchina.com DEBUG 2024-02-23 14:12:30.224253 +08:00 > Accept: / DEBUG 2024-02-23 14:12:30.224257 +08:00 > Connection: TE DEBUG 2024-02-23 14:12:30.224261 +08:00 > TE: gzip DEBUG 2024-02-23 14:12:30.224265 +08:00 > User-Agent: sentry-cli/2.28.6 DEBUG 2024-02-23 14:12:30.225401 +08:00 > Authorization: Bearer d9e2c7cd** DEBUG 2024-02-23 14:12:30.328836 +08:00 < HTTP/1.1 200 OK DEBUG 2024-02-23 14:12:30.328873 +08:00 < Server: nginx DEBUG 2024-02-23 14:12:30.328898 +08:00 < Date: Fri, 23 Feb 2024 06:12:30 GMT DEBUG 2024-02-23 14:12:30.328914 +08:00 < Content-Type: application/json DEBUG 2024-02-23 14:12:30.328926 +08:00 < Content-Length: 6997 DEBUG 2024-02-23 14:12:30.328938 +08:00 < Connection: keep-alive DEBUG 2024-02-23 14:12:30.328949 +08:00 < Allow: GET, HEAD, OPTIONS DEBUG 2024-02-23 14:12:30.328962 +08:00 < Access-Control-Allow-Methods: GET, HEAD, OPTIONS DEBUG 2024-02-23 14:12:30.328987 +08:00 < Access-Control-Allow-Headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding, sentry-trace, baggage, X-CSRFToken DEBUG 2024-02-23 14:12:30.329001 +08:00 < Access-Control-Expose-Headers: X-Sentry-Error, X-Sentry-Direct-Hit, X-Hits, X-Max-Hits, Endpoint, Retry-After, Link DEBUG 2024-02-23 14:12:30.329014 +08:00 < Access-Control-Allow-Origin: DEBUG 2024-02-23 14:12:30.329027 +08:00 < Vary: Accept-Language, Cookie DEBUG 2024-02-23 14:12:30.329038 +08:00 < Content-Language: en DEBUG 2024-02-23 14:12:30.329048 +08:00 < X-Frame-Options: deny DEBUG 2024-02-23 14:12:30.329058 +08:00 < X-Content-Type-Options: nosniff DEBUG 2024-02-23 14:12:30.329071 +08:00 < X-XSS-Protection: 1; mode=block DEBUG 2024-02-23 14:12:30.329086 +08:00 < Content-Security-Policy-Report-Only: img-src blob: data: ; connect-src 'self' .algolia.net .algolianet.com .algolia.io; object-src 'none'; script-src 'self' 'unsafe-inline' 'report-sample'; frame-ancestors 'none'; base-uri 'none'; style-src 'unsafe-inline' ; default-src 'none'; font-src 'self' data:; media-src DEBUG 2024-02-23 14:12:30.329101 +08:00 < Strict-Transport-Security: max-age=31536000 DEBUG 2024-02-23 14:12:30.329136 +08:00 response status: 200 DEBUG 2024-02-23 14:12:30.329162 +08:00 body: {"event_id":"34e0c4acf5294e9d9d1ae532bbe11705","project":26,"release":"0d420f09c9f3ecee64cb77f86200e46c6f6cef81","dist":null,"platform":"javascript","message":"","datetime":"2024-02-23T03:03:22+00:00","tags":[["browser","Chrome 121.0.0"],["browser.name","Chrome"],["device","Mac"],["device.family","Mac"],["environment","production"],["handled","no"],["level","error"],["mechanism","generic"],["os","Mac OS X >=10.15.7"],["os.name","Mac OS X"],["replayId","1dc4f716d9084a6da804ccc54da803e2"],["release","0d420f09c9f3ecee64cb77f86200e46c6f6cef81"],["user","ip:172.31.0.1"],["url","http://localhost:5173/dashboard"]],"_metrics":{"bytes.ingested.event":2785,"bytes.stored.event":10195},"breadcrumbs":{"values":[{"timestamp":1708657398.526,"type":"default","category":"navigation","level":"info","data":{"from":"/dashboard","to":"/dashboard"}},{"timestamp":1708657398.722,"type":"http","category":"xhr","level":"info","data":{"method":"POST","response_body_size":141,"status_code":200,"url":"https://frdtest.hctcchina.com/dms-backend-v2/index/report"}},{"timestamp":1708657399.767,"type":"default","category":"sentry.transaction","level":"info","message":"d51fd87a29ec46c79512e51d78032cd9","event_id":"d51fd87a29ec46c79512e51d78032cd9"},{"timestamp":1708657402.186,"type":"default","category":"ui.click","level":"info","message":"div.dashboard-editor-container > div.board > p.board_title"}]},"contexts":{"browser":{"name":"Chrome","version":"121.0.0","type":"browser"},"device":{"family":"Mac","model":"Mac","brand":"Apple","type":"device"},"os":{"name":"Mac OS X","version":">=10.15.7","type":"os"},"replay":{"replay_id":"1dc4f716d9084a6da804ccc54da803e2","type":"replay"},"trace":{"trace_id":"91f2a1695cd14b65903a081685177deb","span_id":"ae3e3453dc13b70a","status":"unknown","type":"trace"},"vue":{"componentName":"","lifecycleHook":"native event handler","propsData":{},"trace":"\n\nfound in\n\n---> at /Users/gyb/projects/purchase-b2b-project/admin-new-frontend/src/views/dashboard/editor/index.vue... (10 recursive calls)\n ","type":"vue"}},"culprit":"Proxy.myUndefinedFunction(src/views/dashboard/editor/index)","environment":"production","errors":[{"type":"js_no_source","symbolicator_type":"missing_source","url":"http://localhost:5173/node_modules/.vite/deps/chunk-BTB7T7D5.js?v=d3925998"},{"type":"js_no_source","symbolicator_type":"missing_source","url":"http://localhost:5173/src/views/dashboard/editor/index.vue?t=1708657397196"}],"exception":{"values":[{"type":"ReferenceError","value":"myUndefinedFunction is not defined","stacktrace":{"frames":[{"function":"HTMLParagraphElement.invoker","module":"deps/chunk-BTB7T7D5","filename":"/node_modules/.vite/deps/chunk-BTB7T7D5.js","abs_path":"http://localhost:5173/node_modules/.vite/deps/chunk-BTB7T7D5.js?v=d3925998","lineno":10144,"colno":5,"in_app":false,"data":{"orig_in_app":1}},{"function":"callWithAsyncErrorHandling","module":"deps/chunk-BTB7T7D5","filename":"/node_modules/.vite/deps/chunk-BTB7T7D5.js","abs_path":"http://localhost:5173/node_modules/.vite/deps/chunk-BTB7T7D5.js?v=d3925998","lineno":1642,"colno":17,"in_app":false,"data":{"orig_in_app":1}},{"function":"callWithErrorHandling","module":"deps/chunk-BTB7T7D5","filename":"/node_modules/.vite/deps/chunk-BTB7T7D5.js","abs_path":"http://localhost:5173/node_modules/.vite/deps/chunk-BTB7T7D5.js?v=d3925998","lineno":1634,"colno":18,"in_app":false,"data":{"orig_in_app":1}},{"function":"_createElementVNode.onClick._cache. ._cache. ","module":"src/views/dashboard/editor/index","filename":"/src/views/dashboard/editor/index.vue","abs_path":"http://localhost:5173/src/views/dashboard/editor/index.vue?t=1708657397196","lineno":142,"colno":99,"in_app":true},{"function":"Proxy.myUndefinedFunction","module":"src/views/dashboard/editor/index","filename":"/src/views/dashboard/editor/index.vue","abs_path":"http://localhost:5173/src/views/dashboard/editor/index.vue?t=1708657397196","lineno":50,"colno":7,"in_app":true}]},"raw_stacktrace":{"frames":[{"function":"HTMLParagraphElement.invoker","filename":"/node_modules/.vite/deps/chunk-BTB7T7D5.js","abs_path":"http://localhost:5173/node_modules/.vite/deps/chunk-BTB7T7D5.js?v=d3925998","lineno":10144,"colno":5,"in_app":false,"data":{"orig_in_app":1}},{"function":"callWithAsyncErrorHandling","filename":"/node_modules/.vite/deps/chunk-BTB7T7D5.js","abs_path":"http://localhost:5173/node_modules/.vite/deps/chunk-BTB7T7D5.js?v=d3925998","lineno":1642,"colno":17,"in_app":false,"data":{"orig_in_app":1}},{"function":"callWithErrorHandling","filename":"/node_modules/.vite/deps/chunk-BTB7T7D5.js","abs_path":"http://localhost:5173/node_modules/.vite/deps/chunk-BTB7T7D5.js?v=d3925998","lineno":1634,"colno":18,"in_app":false,"data":{"orig_in_app":1}},{"function":"_createElementVNode.onClick._cache. ._cache. ","filename":"/src/views/dashboard/editor/index.vue","abs_path":"http://localhost:5173/src/views/dashboard/editor/index.vue?t=1708657397196","lineno":142,"colno":99,"in_app":true},{"function":"Proxy.myUndefinedFunction","filename":"/src/views/dashboard/editor/index.vue","abs_path":"http://localhost:5173/src/views/dashboard/editor/index.vue?t=1708657397196","lineno":50,"colno":7,"in_app":true}]},"mechanism":{"type":"generic","handled":false}}]},"fingerprint":["{{ default }}"],"grouping_config":{"enhancements":"eJybzDRxc15qeXFJZU6qlZGBkbGugaGuoeEEAHJMCAM","id":"newstyle:2023-01-11"},"hashes":["ef3d0427cb60158ce787ab28b4b1ade5","c7bcfae836e7bd732038859bda6c87ab"],"key_id":"26","level":"error","location":"/src/views/dashboard/editor/index.vue","logger":"","metadata":{"display_title_with_tree_label":false,"filename":"/src/views/dashboard/editor/index.vue","function":"Proxy.myUndefinedFunction","in_app_frame_mix":"mixed","type":"ReferenceError","value":"myUndefinedFunction is not defined"},"nodestore_insert":1708657402.489397,"received":1708657402.32592,"request":{"url":"http://localhost:5173/dashboard","headers":[["Referer","http://localhost:5173/dashboard"],["User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"]]},"scraping_attempts":[{"details":"Can't connect to restricted host localhost","reason":"invalid_host","status":"failure","url":"http://localhost:5173/node_modules/.vite/deps/chunk-BTB7T7D5.js?v=d3925998"},{"details":"Can't connect to restricted host localhost","reason":"invalid_host","status":"failure","url":"http://localhost:5173/src/views/dashboard/editor/index.vue?t=1708657397196"}],"sdk":{"name":"sentry.javascript.vue","version":"7.102.0","integrations":["InboundFilters","FunctionToString","TryCatch","Breadcrumbs","GlobalHandlers","LinkedErrors","Dedupe","HttpContext","Vue","BrowserTracing","Replay"],"packages":[{"name":"npm:@sentry/vue","version":"7.102.0"}]},"timestamp":1708657402.194,"title":"ReferenceError: myUndefinedFunction is not defined","type":"error","user":{"ip_address":"172.31.0.1"},"version":"7"} ✔ Fetched data for event: 34e0c4acf5294e9d9d1ae532bbe11705 ✔ Event has release name: 0d420f09c9f3ecee64cb77f86200e46c6f6cef81 ✔ Event has a valid exception present ✔ Event has a valid stacktrace present ⚠ Exception is already source mapped and first resolved frame points to: [missing context line] INFO 2024-02-23 14:12:30.334634 +08:00 Skipping update nagger update check
I am guessing there still is some sort of configuration issue on your side since this is working in SaaS for you. If you go to your project settings -> Source Maps. What do you see?
@hubertdeng123 Thank you for your reply, I have solved this problem. I found the cause by using docker compose logs -f. When I reported the error, I noticed that the requests were going through Docker's proxy port, thus failing to connect to the symbolicator. After I disabled the proxy in ~/.docker/config.json and /etc/systemd/system/docker.service.d/http-proxy.conf, and ran docker compose down && docker compose up -d, I reported the error again. Now, the error can be traced back to the source code.
Self-Hosted Version
24.1.0
CPU Architecture
x86_64
Docker Version
24.0.2
Docker Compose Version
2.21.0
Steps to Reproduce
Open the minimal implementation repository, https://github.com/kkflie/self-hosted-vue, and reproduce according to the README.md.
If using https://sentry.io/, you can see that the exception is located in src/App and pinpointed to the specific source code.
If using self-hosted Sentry, you can only locate it to the bundled file, such as assets/index-BckaPTcO, and cannot pinpoint to the source code.
I have read through https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/. In it, the manual verification steps seem fine. However, when I validate through sentry-cli, I noticed that if using https://sentry.io/, sentry-cli sourcemaps --org orgnization --project project explain eventId can pinpoint to the correct source code. If using self-hosted Sentry, it will issue a warning: "You don't have permission to perform this action."
It seems to be an issue related to the token. When using an Organization Auth Token with sentry-cli and writing this token into ~/.sentryclirc, sentry-cli sourcemaps --org organization --project project explain eventId doesn't have permission to access. By the way, when I use https://sentry.io/, I also use a User Auth Token instead of an Organization Auth Token to accurately locate the source code. Otherwise, it throws an error: 'sentry reported an error: You do not have permission to perform this action. (http status: 403)'. Only with the User Auth Token can I get the correct result.
https://sentry.io/, using User Auth Token
https://sentry.io/, using Organization Auth Token
self-hosted sentry, using User Auth Token
self-hosted, using Organization Auth Token
Expected Result
Self-hosted Sentry can use sourcemaps to pinpoint errors to specific source code locations.
Actual Result
Self-hosted Sentry can only pinpoint errors to bundled files.
Event ID
No response