sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Sourcemaps not mapping for app hosted in Subdirectory

Open sahilanguralla opened this issue 8 years ago • 1 comments

I am facing an issue in which source maps are not getting mapped to file because my application is hosted on a subdirectory but the source maps are with respect to root path. I can't use the urlPrefix option in sentry-cli, while uploading source-maps, as the subdirectory path is dynamic.

Is there any way in raven-js to set app's base url which will be treated as root of the app so that the same is sent with errors? In other words, if my app is hosted at https://somedomain.com/some/random/path/with/random/id/BASE_APP_URL/index.html and I set an option in SDK config like this

window.SENTRY_SDK = {
            url: Constant.SENTRY_CONFIG.URL,
            dsn: Constant.SENTRY_CONFIG.DSN,
            options: {
                baseURL: 'https://somedomain.com/some/random/path/with/random/id/BASE_APP_URL/',
                release: Constant.RELEASE,
                environment: env
            }
        };

the sourcemaps are mapped starting from BASE_APP_URL/....

sahilanguralla avatar Jun 20 '18 13:06 sahilanguralla

Yes, you can rewrite stack frames to make this happen - https://docs.sentry.io/clients/node/sourcemaps/#updating-raven-configuration-to-support-source-maps (it's almost exactly the same in javascript sdk) Please feel free to reopen if it's still relevant.

kamilogorek avatar Sep 11 '18 11:09 kamilogorek