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

Using source maps, not showing original code #54

Closed
DimitarNestorov opened this issue Apr 4, 2018 · 37 comments
Closed

Using source maps, not showing original code #54

DimitarNestorov opened this issue Apr 4, 2018 · 37 comments

Comments

@DimitarNestorov
Copy link

What I'm getting:
image

What I'm expecting:
image

I have uploaded the same source maps both with prefix app:https:///build/ and ~/.

@kamilogorek
Copy link
Contributor

Can you provide a link to the event from your Sentry account?

@DimitarNestorov
Copy link
Author

@kamilogorek it's on a docker instance. Can you get access to docker instances? Otherwise I can make you an account

@kamilogorek
Copy link
Contributor

kamilogorek commented Apr 5, 2018

Ah, ok. Can you show a list of your release artifacts and event JSON itself then?

It should be here:
screen shot 2018-04-05 at 14 56 50

And JSON here (bottom right corner):
screen shot 2018-04-05 at 14 57 01

@DimitarNestorov
Copy link
Author

JSON: https://pastebin.com/P1nz9Enn

Artifacts (text version): https://pastebin.com/Pvqc2iyL

Artifacts:
sentry codemotionapps com_codemotion_frontend_releases_0 9 0-11_artifacts_
sentry codemotionapps com_codemotion_frontend_releases_0 9 0-11_artifacts_ 1

@DimitarNestorov
Copy link
Author

We've been having issues with uploading Electron symbols and we can't upload breakpad files onto our Docker instance and I was led to the conclusion that 8.22 is too old and a new release would fix the issue (getsentry/sentry#7804).
Could that also be the reason for this issue?

@jan-auer
Copy link
Member

jan-auer commented Apr 9, 2018

@DimitarNestorov, thanks for providing more context. From what you are saying, it seems you are having two issues.

Let's start with JavaScript code context and source maps. It seems that you're uploading the right source maps, but they are missing the /build/ path component. I suspect this is why Sentry is not able to match them up correctly. I'm not sure how you're uploading the source maps right now, but you can try to:

  • Run the CLI command from the parent folder
  • Set the --url-prefix option to ~/build/ as described here
  • Configure the urlPrefix option if you use our webpack plugin

After that, the paths of your source maps on the releases page should match the ones in the issue exactly (or actually, you should start seeing the resolved source files). Let me know if that does not work, as I'm currently investigating an issue with source maps in renderer processes.

Regarding native debug information files (Electron symbols). You do not need to upload Electron symbols for JavaScript support, they are only required for native crashes. Unfortunately, even if you could upload those symbols, 8.22 does not yet have the capability of dealing with native crashes. Let's continue that discussion in getsentry/sentry#7804.

@DimitarNestorov
Copy link
Author

Tried using url prefix ~/build/ but it didn't work.

image

image

@kamilogorek
Copy link
Contributor

@DimitarNestorov are those all the artifacts that you upload? If so, then you missed all the source files :) We need a 1 to 1 js.map to .js mapping, so we can correlate them correctly.

This is how browsers work as well. What we do is we take a look at each stacktrace's frame and pull out the culprit file, let's say b8g7ws9024j89dfgsa.js. Then we have to either scrape it from your server (if it's a remote url), or look for it in uploaded artifacts. When we find it, then, and only then, we can read it to determine whether it contains linked sourcemap (by veryfing the existence of the standard sourcemap suffix, eg. //# sourceMappingURL=b8g7ws9024j89dfgsa.js.map).

What most likely happens here is that we are not able to find the source file itself, so the system is not able to understand what's it's sourcemap file is (as there's nothing that stops you from having a sourcecode in foo.js file and link a sourcemap from bar.js.map to it).

@DimitarNestorov
Copy link
Author

Thanks @kamilogorek for the explanation. You were right, I need to upload both the .js and .js.map files for it to work. I didn't upload them since on the web version of our app it worked without doing so, that made me think that sentry doesn't need them at all.

@kg-currenxie
Copy link

Great investigation and solution :) This was exactly our problem too! <3

@chj-damon
Copy link

@DimitarNestorov are those all the artifacts that you upload? If so, then you missed all the source files :) We need a 1 to 1 js.map to .js mapping, so we can correlate them correctly.

This is how browsers work as well. What we do is we take a look at each stacktrace's frame and pull out the culprit file, let's say b8g7ws9024j89dfgsa.js. Then we have to either scrape it from your server (if it's a remote url), or look for it in uploaded artifacts. When we find it, then, and only then, we can read it to determine whether it contains linked sourcemap (by veryfing the existence of the standard sourcemap suffix, eg. //# sourceMappingURL=b8g7ws9024j89dfgsa.js.map).

What most likely happens here is that we are not able to find the source file itself, so the system is not able to understand what's it's sourcemap file is (as there's nothing that stops you from having a sourcecode in foo.js file and link a sourcemap from bar.js.map to it).

hi @DimitarNestorov as you replied this: Then we have to either scrape it from your server (if it's a remote url), or look for it in uploaded artifacts, could you be more specific about when it will look for sourcemap from the uploaded artifacts? in my case it always looks form my server, so If I deleted all sourcemaps in my server (which is recommended to do so), I cannot see the detail of error any more.

@DimitarNestorov
Copy link
Author

@kamilogorek I believe @chj-damon meant to mention you instead of me

@chj-damon
Copy link

I've solved this problem. it is because something went wrong in the docker.

@ffarthbe
Copy link

I've solved this problem. it is because something went wrong in the docker.

@chj-damon 兄弟可以私聊一下怎么解决的吗,我这边也是涉及到docker镜像,正确上传了js和map文件却没办法回溯代码

@Dipesh-Das97
Copy link

Hi I have faced a similar issue, only I don't have a git repo integration. I am trying to use the local repo as for now. The source files and the source maps are uploaded to artifacts but I still can't see the original code in the error event. I really need help!

@Dipesh-Das97
Copy link

Dipesh-Das97 commented May 9, 2021

If someone needs any more info or wants to see how I am using a dummy repo to check, you may ask. I am ready to provide info.

@Dipesh-Das97
Copy link

Dipesh-Das97 commented May 9, 2021

Screenshot (262)
These are the artifacts

@Dipesh-Das97
Copy link

Dipesh-Das97 commented May 9, 2021

I am using the 3 below variables and then executing them in a js file
const create_release = sentry-cli releases --org=${SENTRY_ORG} new --project=${SENTRY_PROJECT} ${REACT_APP_SENTRY_RELEASE};

const associate_commits = sentry-cli releases --org=${SENTRY_ORG} --project=${SENTRY_PROJECT} set-commits --auto ${REACT_APP_SENTRY_RELEASE};

const script = sentry-cli releases --org=${SENTRY_ORG} --project=${SENTRY_PROJECT} files ${REACT_APP_SENTRY_RELEASE} upload-sourcemaps --url-prefix "~/build/static/js" --validate build/static/js

@Dipesh-Das97
Copy link

At this point I checked all the possible things I could do wrong and even the #SourceMappingURLs are fine.

IT IS FROM A CREATE REACT APP.

the build on generation are g-zipped

@Dipesh-Das97
Copy link

Screenshot (263)
This is the structure of the local repo

@vidt6
Copy link

vidt6 commented Jul 21, 2022

@Dipesh-Das97 Hi, do you resolve that problem?

@kamilogorek
Copy link
Contributor

@vidt6 you can use sentry-cli now to understand if/what went wrong. See first section https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/

@Dipesh-Das97
Copy link

@kamilogorek it's more of a query. In my application I can see the source maps pointing towards the exact code however for some cases I don't see the source map even available. I think all the source maps are uploaded properly and it still is not detecting the actual error. Sentry is initialised at the root of the app. Can you share any suggestions?

@kamilogorek
Copy link
Contributor

Ah, sorry, I dont know exactly how electron-sdk is setup, you'll need to create a new issue for that.

@Dipesh-Das97
Copy link

@kamilogorek it is for a react JS setup not electron.

@vidt6
Copy link

vidt6 commented Jul 21, 2022

@kamilogorek I don't know what is error. This is my script to upload source map to sentry
image
And in sentry it shows like this
image

@vidt6
Copy link

vidt6 commented Jul 21, 2022

And error is
image

@vidt6
Copy link

vidt6 commented Jul 21, 2022

@kamilogorek Can you tell me what the error is? Thanks a lot

@kamilogorek
Copy link
Contributor

Well, it tries to find bundle.js but there is no such file uploaded :3

@vidt6
Copy link

vidt6 commented Jul 21, 2022

When I run build, it export folder
image

@vidt6
Copy link

vidt6 commented Jul 21, 2022

I cannot see this bundle.js in that folder

@kamilogorek
Copy link
Contributor

This is what your stacktrace frame points to, it's impossible for me to know how it's produced without seeing the codebase.

@vidt6
Copy link

vidt6 commented Jul 21, 2022

Oh I know but it's the source of my company. Can you suggest me where to check this error?

@kamilogorek
Copy link
Contributor

It's literally on the screen you posted above. Inside that event, click on "raw" and you'll see exact thing that was thrown inside your browser:

image

@vidt6
Copy link

vidt6 commented Jul 21, 2022

It's here, right?
image

@kamilogorek
Copy link
Contributor

Yes

@chintsan
Copy link

chintsan commented Oct 1, 2022

Since this is close i have created new issue. (#567) and referred below.

Please can you assist as to why we aren't see source map / original code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants