Skip to content

Commit 87c31f5

Browse files
committed
Merge pull request #484 from getsentry/source-maps-help
Add source maps troubleshooting section
2 parents 373122f + 8478670 commit 87c31f5

File tree

1 file changed

+44
-5
lines changed

1 file changed

+44
-5
lines changed

docs/sourcemaps.rst

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,48 @@ Additional information can be found in the `Releases API documentation
152152

153153
.. sentry:edition:: hosted
154154
155-
Working Behind a Firewall
156-
-------------------------
155+
Working Behind a Firewall
156+
-------------------------
157157

158-
While the recommended solution is to upload your source artifacts to
159-
Sentry, sometimes it's necessary to allow communication from Sentry's
160-
internal IPs. For more information on Sentry's public IPs, see :ref:`ip-ranges`.
158+
While the recommended solution is to upload your source artifacts to
159+
Sentry, sometimes it's necessary to allow communication from Sentry's
160+
internal IPs. For more information on Sentry's public IPs, see :ref:`ip-ranges`.
161+
162+
Troubleshooting
163+
---------------
164+
165+
Source maps can sometimes be tricky to get going. If you're having trouble, try the following tips.
166+
167+
Verify sourceMappingURL is present
168+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169+
170+
Some CDNs automatically strip comments from static files, including JavaScript files. This can have the effect of stripping your JavaScript file of its ``sourceMappingURL`` directive, because it is considered a comment. For example, CloudFlare has a feature called `Auto-Minify
171+
<https://blog.cloudflare.com/an-all-new-and-improved-autominify/>`_ which will strip ``sourceMappingURL`` if it is enabled.
172+
173+
Double-check that your deployed, final JavaScript files have ``sourceMappingURL`` present.
174+
175+
Verify artifact names match sourceMappingURL
176+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177+
178+
When `uploading source maps to Sentry
179+
<#uploading-source-maps-to-sentry>`_, you must name your source map files with the same name found in ``sourceMappingURL``.
180+
181+
__ Uploading Source Maps to Sentry
182+
183+
For example, if you have the following in a minified application file, ``app.min.js``:
184+
185+
.. code-block:: javascript
186+
187+
//-- end app.min.js
188+
//# sourceMappingURL=https://example.com/dist/js/app.min.js.map
189+
190+
Sentry will look for a matching artifact named exactly ``https://example.com/dist/js/app.min.js.map``.
191+
192+
Note also that Sentry will resolve relative paths. For example, if you have the following:
193+
194+
.. code-block:: JavaScript
195+
196+
// -- end app.min.js (located at https://example.com/dist/js/app.min.js)
197+
//# sourceMappingURL=app.min.js.map
198+
199+
Sentry will resolve ``sourceMappingURL`` relative to ``https://example.com/dist/js/`` (the root path from which ``app.min.js`` was served). You will again need to name your source map with the full URL: ``https://example.com/dist/js/app.min.js.map``.

0 commit comments

Comments
 (0)