Closed cxspxr closed 1 year ago
reassigned because I don't know sourcemaps
@cxspxr Just to double-check, you are not doing any deploys in the meantime of your JS bundles, right? You are also not updating release
or dist
when calling Sentry.init
?
Speaking of, can you post how you initialize the Sentry SDK?
No, we're not doing any extra deploys, just that via webpack plugin sourcemaps.io tells us that bundle is incorrect and sourceMappingUrl is missing which is not true
app/javascript/packs/index.tsx
if (!window.location.host.includes("localhost") && !window.location.host.includes("192.168")) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.SERVER_ENV || "development",
beforeSend: (event, hint) => {
if (!hint) return event
const error = hint.originalException as any
if (error && error.stack && error.stack.match(/syncfusion/)) {
event.fingerprint = ["syncfusion", error.message]
} else if (error && error.message === "Network Error") {
event.fingerprint = ["network-error"]
}
return event
},
})
}
@cxspxr Can you also share a link to an issue please?
Yes, sure: https://sentry.io/organizations/12vbiz/issues/2188684763/?project=1356811&referrer=slack
Oh, and now I noticed that the issue with working sourcemaps has been merged into the one where sourcemaps don't work. May it be the cause? But still I am not sure, it would be super great if you could ensure if everything is fine because it's 3rd time we tried to configure sourcemaps and it worked all 3 times with different approaches and after a while we still received not-mapped code issues.
The last issue that has been merged to that one contains the correct trace with sourcemaps working
This issue 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 label it Status: Accepted
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
@cxspxr based on the issue you linked above:
/packs/js/index-2c59116487be30432926.js
3694b134c2c0264a587b7a9363ff65434821a853
~/public/packs/js/index-2c59116487be30432926.js
public/
prefixI can see you have this option set, but that's the issue, so maybe there was some webpack misconfiguration. You can run your uploads with SENTRY_LOG_LEVEL=debug
to see what command is exactly used for uploads (it'll confirm to you whether prefixes are passed correctly to cli).
Still no success. But sourcemaps do work in Chrome, I doubt it's webpack misconfiguration then
Not sure, tried to upload public
path only, not stripping a prefix - the same issue.
@cxspxr can you also share these information:
config/webpacker.yml
I'll take a look from the webpacker gem/Rails perspective
@cxspxr can you share a link to the latest event that should but doesn't work?
@st0012
config/webpacker.yml
# Note: You must restart bin/webpack-dev-server for changes to take effect
default: &default
source_path: app/javascript
source_entry_path: packs
public_output_path: packs
cache_path: tmp/cache/webpacker
check_yarn_integrity: false
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: []
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
webpack_compile_output: true
# Extract and emit a css file
extract_css: false
static_assets_extensions:
- .jpg
- .jpeg
- .png
- .gif
- .tiff
- .ico
- .svg
- .eot
- .otf
- .ttf
- .woff
- .woff2
extensions:
- .mjs
- .tsx
- .ts
- .jsx
- .js
- .sass
- .scss
- .css
- .module.sass
- .module.scss
- .module.css
- .png
- .svg
- .gif
- .jpeg
- .jpg
development:
<<: *default
compile: true
# Verifies that versions and hashed value of the package contents in the project's package.json
check_yarn_integrity: true
# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
host: localhost
port: 3035
public: localhost:3035
hmr: false
# Inline should be set to true if using HMR
inline: true
overlay: true
compress: true
disable_host_check: true
use_local_ip: false
quiet: false
headers:
"Access-Control-Allow-Origin": "*"
watch_options:
ignored: "**/node_modules/**"
test:
<<: *default
compile: true
# Compile test packs to a separate directory
public_output_path: packs-test
production:
<<: *default
# Production depends on precompilation of packs prior to booting for performance.
compile: false
# Extract and emit a css file
extract_css: true
# Cache manifest.json for performance
cache_manifest: true
Rails: 6.0.3.5 Webpacker: 5.1
but virtually any on the front-end, they are all not mapped.
Because in this comment @kamilogorek mentioned that the uploaded sourcemap contains the extra ~/public
prefix that's causing the issue, I decided to reproduce the same result locally and see what could be the cause of that.
So I added webpacker to sentry-ruby
SDK's example app in the webpacker-example branch (PR: https://github.com/getsentry/sentry-ruby/pull/1355). I also tried adopting the exact same webpacker configs as @cxspxr's application has.
But I can always get the source maps uploaded correctly
and have the stacktrace linked correctly (report link)
The only way I can add the public
prefix to the source map names is to add the urlPrefix
option like:
new SentryCliPlugin({
include: "./public/",
ignore: ["node_modules"],
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "sentry-sdks",
project: "sentry-ruby",
stripPrefix: ["public"],
urlPrefix: "~/public" // <----- This line
})
You can see that it now has the public
prefix.
Not sure if it's possible that urlPrefix
is injected accidentally? I checked the source code of sentry-cli
and sentry-webpacker-plugin
but didn't find anything like a ENV to do that. @kamilogorek I hope this would help though.
(PR for the webpacker example https://github.com/getsentry/sentry-ruby/pull/1355)
For now I will proceed with
new SentryCliPlugin({
include: "./public/packs/js/",
ignore: ["node_modules"],
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "12vbiz",
project: "12vbiz",
deploy: {
env: process.env.ENVIRONMENT_IDENTIFIER,
},
urlPrefix: "~/packs/js",
setCommits: {
repo: "tonydehnke/12vBiz",
commit: process.env.SOURCE_VERSION,
},
})
Because this seems to work for now. But previous configs worked as well for some time and then they eventually failed to map the sources after some time with new releases coming.
So again, config above did work for some time/some issues, some issues have been mapped, but for majority - it doesn't map MAPPED: https://sentry.io/organizations/12vbiz/issues/2291237732/?project=1356811&query=is%3Aunresolved https://sentry.io/organizations/12vbiz/issues/2172063029/?project=1356811&query=is%3Aunresolved https://sentry.io/organizations/12vbiz/issues/2073891396/?project=1356811&query=is%3Aunresolved https://sentry.io/organizations/12vbiz/issues/2291238086/?project=1356811&query=is%3Aunresolved
NOT MAPPED: https://sentry.io/organizations/12vbiz/issues/2291180045/?project=1356811&referrer=slack https://sentry.io/organizations/12vbiz/issues/2289961069/?project=1356811&query=is%3Aunresolved https://sentry.io/organizations/12vbiz/issues/2288291909/?project=1356811&query=is%3Aunresolved
Issues occurred on the same day, with the very same config, some being mapped, some not
But now files are uploaded without public
in their path for sure, it should work
Artifacts from your 2nd example are just broken, that's why it's not mapped. No idea why, and how your setup works, but this is the main issue.
Let's compare 2 examples.
Issue: https://sentry.io/organizations/12vbiz/issues/2291237732/?project=1356811 Release: https://sentry.io/settings/12vbiz/projects/12vbiz/source-maps/c0401df7054790c410dbc566c587ea3c4722d79b/ File: ~/packs/js/index-c001f75d00abb164813d.js.map Frame position: 2:3194127
npx source-map-cli resolve index-c001f75d00abb164813d.js.map 2 3194127
Maps to webpack:///app/javascript/components/CheckForm.tsx:192:64 (map)
const checkItemElements = form.values[itemsFieldName].map((item, index) =>
^
Issue: https://sentry.io/organizations/12vbiz/issues/2291180045/?project=1356811 Release: https://sentry.io/settings/12vbiz/projects/12vbiz/source-maps/ee75130aeee03214c60bbba6a1becc7231e9676d/ File: ~/packs/js/index-94f87e3b61a070045f4b.js.map Frame position: 1:3019812
npx source-map-cli resolve index-94f87e3b61a070045f4b.js.map 1 3019812
Could not resolve mapping: Mapping not found
However, when we move one line lower, to line 2 it works just fine:
MMaps to webpack:///node_modules/@syncfusion/ej2-schedule/src/schedule/renderer/vertical-view.js:395:86 (offsetHeight)
currentTimeEle.style.top = formatUnit(currentTimeEle.offsetTop - currentTimeEle.offsetHeight / 2);
^
It appears that for some reason, your code is sometimes correctly detecting line number 2, and sometimes it skips the initial comment line /*! For license information please see index-94f87e3b61a070045f4b.js.LICENSE.txt */
and ignores it completely reporting as frames come from there.
We cannot solve it on the serverside, nor in the SDK, as we don't control input given to us.
Is there a Sentry implementation specialist that we can hire to help resolve this?
@tonydehnke feel free to join our Discord https://discord.com/invite/Ww9hbqr or explain your issue in detail either here or through DM/mail and I'll see what we can do.
@kamilogorek - I'm a non-tech founder, so I can't really add much more than what has been shown above, unfortunately. Hence looking for someone that has experience with it to help get things working.
@tonydehnke you may want to look elsewhere then as GitHub issues are for reporting bug or feature requests. We cannot offer help to fix your setup or advertise this place to get help for you.
Thanks @BYK - I understand. If you have any thoughts on where else would be good I would appreciate any suggestions.
@tonydehnke - I would have said the forums but haven't seen folks getting this kind of help there much. Maybe StackOverflow or just hiring someone from those one-off contracting sites?
This issue 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 label it Status: Backlog
or Status: In Progress
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
We were having a similar problem, which turned out to be devs running the production version while testing fixes from feature branches. Which uploaded different source maps than what would have mapped to the deployed application.
Might be your issue or might not, figured I would throw it out there.
Routing to @getsentry/telemetry-experience for triage, due by (vie). ⏲️
@tonydehnke Want to reach out to me (kyrix) on discord https://discord.gg/sentry if this issue still persists?
Closed due to inactivity, and hopefully improved with debug id sourcemaps: https://github.com/getsentry/team-webplatform-meta/issues/17
Important Details
We have tried to configure sourcemaps multiple times in our project. And the story is that actually the solutions found in your guide, on medium, stackoverflow, and that we applied worked for a while and then they suddenly broke.
https://toolbox.12v.biz/packs/js/index-e89897c5421c54275a15.js https://toolbox.12v.biz/packs/js/index-e89897c5421c54275a15.js.map
Web archive in case we will re-build the project (but you can still visit the website and see the bundle name in sources with corresponding
.map
) https://web.archive.org/web/20210218082222/https://toolbox.12v.biz/packs/js/index-e89897c5421c54275a15.js https://web.archive.org/web/20210218082318/https://toolbox.12v.biz/packs/js/index-e89897c5421c54275a15.js.mapBoth artifacts we have uploaded to sentry as
~/packs/js...
and it shows that they're successfully uploaded and we can find these files in the release.https://sourcemaps.io/ showing that we don't have
//# sourceMappingUrl
declaration but you can clearly see we have it (not in webarchive for some matter, maybe because webarchive put their comment there instead)How are you running Sentry?
Saas (sentry.io)
Description
Sourcemaps doesn't work after some time.
Steps to Reproduce
Not sure how you would reproduce it, I still think that it something with our configuration, the only thing I really don't get is that how it works for a while and then doesn't.
config/webpack/production.js
config/webpack/environment.js
What you expected to happen
It should work (and it did for a week) and it should map the sources to the minified webpack bundles correctly as it really does in browser when showing some stacktraces etc.