#Using --sourcemaps changes the hash for files

1 messages · Page 1 of 1 (latest)

clever dawn
#

I am trying to get sourcemaps working for a sentry integration and notice that when I use --sourcemaps on my build script is changes the hash for the build files. This results in my sourcemaps not matching on Sentry.

In my docker file (my app is hosted on fly), I build my app without this flag, however when I build it in a Github Action I use this flag to create the sourcemaps to upload to Sentry.

How can I resolve this?

sonic hazel
#

AFAIK the file needs to have a comment referencing the sourcemap file, so this cause a hash change because the file without sourcemaps doesn’t have that comment

clever dawn
#

Is there any way you can think of uploading source maps without exposing them publicly? I am finding debugging issues in production challenging without having them.

grave gorge
#

I've run into this in the past as well. You can build with source maps enabled in docker and then delete the source maps before publishing. That way the deployed production files will have the comment referencing the source maps (what sentry needs). But since you didn't deploy the actual source maps, if someone opens dev tools they won't be able to see the original source code since the browser would have gotten a 404 requesting the source map. I think in safari you will see these 404s in the console, but not in chrome IIRC

#

Browsers also should only request the sourcemaps when dev tools is opened so you shouldn't see a huge number of 404s in your logs from regular users browsing the site

clever dawn
#

@grave gorge thanks for the info, it worked! I can now see the same hash for files, and they are uploading perfectly in Sentry. I have noticed however, the server side code (ie any code in loaders or actions) the mapping doesn't work. It still shows the generated JS instead of the Typescript. Have you experienced this?

It does work perfectly for any client side generate code. I am using the util created by the sentry team sentry-upload-sourcemaps so perhaps there is a bug there.

#

I have tried to upload an screenshot to show you but it keeps failing.. 🤷🏼‍♂️

grave gorge
#

You may need a separate upload of the server build sourcemaps for that, to go along with the sentry node plugin. Their util is likely only uploading the client sourcemaps if I had to guess

clever dawn
#

Ah yes, I think you are right @grave gorge .I just did an audit of the sourcemaps and the server build maps are not there. I'll see if I can get them working with a separate upload.

bright badge
#

@clever dawn sorry to resurrect this a bit, but did you figure out the server-code source maps for Sentry?

#

Also are you using Express like in the blues stack, or just remix serve?

clever dawn
#

If you have the chance to raise a PR that would be great! I haven't been able to find the time yet to raise one 😓

#

I am using remix serve 🙂