Source code not found on JS files


we run on-premise Sentry and we’re facing issues with incorrect mapping *.map files to original source files .ts/.js.

Every release i create new version, upload source maps with sentry-cli binary to this version, but if error will occure, we got error “Source code was not found” and Sentry wants to find them on website, instead on release artifacts.

Source maps are working fine, if they’re on the website. When we delete them, Sentry won’t find them. I tried even disable “Enable JavaScript source fetching” on project, but it didn’t helped.

Source maps are working fine even in development, so i think there is not problem in source maps.

We even upload dist JS files (our source is *.ts). Do we need to upload them?

Server version: 9.1.2
Client SDK version: sentry.javascript.browser:6.0.0

I’ll attach images fe. for version 2021.124.3.

Inside file ng-app.js is correct sourcemap URL //# This file is on this release as shown from picture.

We create version and upload source maps this way:

sentry-cli releases new -p "userweb-static" "2021.124.3"
sentry-cli releases finalize "2021.124.3"
sentry-cli releases files "2021.124.3" upload-sourcemaps dist/js
sentry-cli releases -p "userweb-static" set-commits --auto "2021.124.3"

Next image (i can upload only 1):

Is there issue with our workflow or with Sentry?


1 Like

Pinging @kamilogorek and @untitaker for help.

Change line 3 to:

sentry-cli releases files "2021.124.3" upload-sourcemaps dist/js --url-prefix "~/js"

This change alone should fix it. Notice that your frames are pointing to /js/ng-app.js but your artifacts are uploaded as ~/ng-app.js (~/ is a protocol globbing matcher here, so it’ll match the initial / part of the URL). They both need to match to resolve correctly.

1 Like

Thank you @kamilogorek .

But unfortunately, it didn’t help.

Can you link an actual event please?

What do you mean “link”? Picture from event was attached and our Sentry is local only.

Ah, right. My bad. I see that you are using environments in the SDK, can you try to specify --dist production in the upload-sourcemaps command?

Tried (environment/distribution is there), but sadly, no change :frowning:

At this point (assuming you triggered an event after artifacts upload), the only thing that can be wrong here is misconfigured on-premise instance, as everything else is setup correctly. cc @BYK

1 Like

Well, we migrated to the cloud Sentry with Team plan and issue didn’t dissappeared :frowning:


The release that this event is pointing to contains only files, but there is no .js file that stack trace frame is pointing to. There has to be a .js file that matches, and it has to contain a valid sourceMappingURL suffix which will be used for mapping.

Ok, i released new version with JS and MAP files, but no. Same issue.


JS sourceMappingURL is: //#

Is it valid? When sourceMappingURL in js file has ~/js/ but artifact path is

This file (and sources also) is in release artifacts.

Or, isn’t problem that error originated from file with url query? js/ng-common.js?version=2021.142.0

That’s really strange, I wonder if we might have a bug with query string handling.
One last thing that I’d like to ask you before digging into the Sentry source maps code itself. Can you specify dist: 'production' in the Sentry.init call as well? I can see environment is set, but dist is not, yet artifacts are uploaded to that distribution.

By the way i tried to remove query (trough RewriteFrames) and it didn’t helped.

You can see here

There is now one more weird bug. Screenshot_20210420_200238

i’ll try that dist.

FYI, this is our init

import * as Sentry from '@sentry/browser';
import * as Integrations from '@sentry/integrations';

function sanitizeFileName(fileName: string) {
	return (
			// uw-static statics requests
			.replace(/(.*)_[a-z0-9]{15,}\.js$/, '$1.js')
			// legacy userweb statics request
			.replace(/(.*)\?time.*/, '$1')
			.replace(/(.*)\?version.*/, '$1')

if (process.env.NODE_ENV === 'production') {
		ignoreErrors: [
			// Random plugins/extensions
			// See:
			"Can't find variable: ZiteReader",
			'jigsaw is not defined',
			'ComboSearch is not defined',
			// Facebook borked
			// ISP "optimizing" proxy - `Cache-Control: no-transform` seems to reduce this. (thanks @acdha)
			// See
			// See
		// Best practices from
		denyUrls: [
			// Facebook flakiness
			// Facebook blocked
			// Woopra flakiness
			// Chrome extensions
			// Other plugins
			/127\.0\.0\.1:4001\/isrunning/i, // Cacaoweb
		maxBreadcrumbs: 20,
		release: `userweb-static@1.2.3`,
		integrations: [
			new Integrations.Angular(),
			new Integrations.RewriteFrames({
				iteratee(frame) {
					if (frame.filename) {
						 * Sentry is creating fingerprint depending on filename.
						 * If release has unique filename hash it will create new issue for already
						 * existing error.
						frame.filename = sanitizeFileName(frame.filename);

					return frame;

	addEventListener('unhandledrejection', (event) => {
		if (event.reason) {

Kamil, i tried to put dist: production and it works! :slight_smile:

I don’t know if there were some changes on your side, but its resolved now.


Thank you.


We’re facing the same issue it seems like, however we cannot make it work by specifying the distribution unfortunately.

This is from a test project on our on premise Sentry.

The test error:
See the reply below this one since I can only put one media file/reply apparently.

The commands to create a release and upload sourcemaps:

sentry-cli releases new "$BUILD_VERSION"
sentry-cli releases files "$BUILD_VERSION" upload-sourcemaps build/static/js --url-prefix '~/static/js' --dist 'production'
sentry-cli releases finalize "$BUILD_VERSION"

This is the setup in the app (small test app generated with create-react-app):

import React from 'react';
import ReactDOM from 'react-dom';
import * as Sentry from '@sentry/react';
import { Integrations } from '@sentry/tracing';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

  dsn: "[DSN_HERE]",
  integrations: [new Integrations.BrowserTracing()],
  environment: process.env.NODE_ENV,
  dist: 'production',

  // Set tracesSampleRate to 1.0 to capture 100%
  // of transactions for performance monitoring.
  // We recommend adjusting this value in production
  tracesSampleRate: 1.0,

    <App />

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more:

I have no clue where it’s going wrong. I’ve been trying to see the logs from /src/sentry/lang/javascript/ fetch_file since that would provide some clues at least but I have no idea where to find the logs.

Any ideas?

The error, referenced from the reply above this.

@rmilesson you need to set a release in Sentry.init to the same value as $BUILD_VERSION to make it resolve.