You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sourcemaps.rst
+55-30Lines changed: 55 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -1,38 +1,49 @@
1
-
.. _sourcemaps:
1
+
.. _raven-js-sourcemaps:
2
2
3
3
Source Maps
4
4
===========
5
5
6
-
In various browsers Sentry supports deminifying JavaScript via source maps. A source map is a file generated
7
-
by your minifier which compresses a mapping of the minified file to the original uncompressed version(s).
6
+
In various browsers Sentry supports deminifying JavaScript via source
7
+
maps. A source map is a file generated by your minifier which compresses a
8
+
mapping of the minified file to the original uncompressed version(s).
8
9
9
-
One important thing to note is that even though we support mapping files, a users browser may not actually be able
10
-
to collect the required information for the server to generate a sourcemap.
10
+
One important thing to note is that even though we support mapping files,
11
+
a users browser may not actually be able to collect the required
12
+
information for the server to generate a sourcemap.
11
13
12
14
Sentry requires the following to be able to map tracebacks to their source:
13
15
14
16
* A source map header or footer
15
17
* A publicly accessible uncompressed version of the source
16
18
* A line of context that includes a line number, column number, and filename
17
19
18
-
The first two items are the responsibility of you, the end-user, and you can take care of publishing them as part
19
-
of your build process. The latter however, with an individual line of context, is severely crippled in many browsers.
20
+
The first two items are the responsibility of you, the end-user, and you
21
+
can take care of publishing them as part of your build process. The latter
22
+
however, with an individual line of context, is severely crippled in many
23
+
browsers.
20
24
21
-
One thing to note is that Sentry will attempt to process the source map before storing (or grouping) an event. This ensures that if we are
22
-
able to deminify the source, we'll be able to more effectively group similar events over time.</p>
25
+
One thing to note is that Sentry will attempt to process the source map
26
+
before storing (or grouping) an event. This ensures that if we are able to
27
+
deminify the source, we'll be able to more effectively group similar
28
+
events over time.</p>
23
29
24
30
Browser Support
25
31
---------------
26
32
27
-
In our experiences, the only browser that routinely delivers usable error reports is **Google Chrome**.
33
+
In our experiences, the only browser that routinely delivers usable error
34
+
reports is **Google Chrome**.
28
35
29
-
For additional information, see this more up-to-date `wiki page <https://github.com/ryanseddon/source-map/wiki/Source-maps:-languages,-tools-and-other-inf>`_.
36
+
For additional information, see this more up-to-date `wiki page
While there are several compression libraries which support source maps, as of writing our recommendation is to use
35
-
`UglifyJS <https://github.com/mishoo/UglifyJS2>`_. That said, many tools such as `webpack <http://webpack.github.io/>`_ and `browserify <http://browserify.org/>`_.
42
+
While there are several compression libraries which support source maps,
43
+
as of writing our recommendation is to use `UglifyJS
44
+
<https://github.com/mishoo/UglifyJS2>`_. That said, many tools such as
45
+
`webpack <http://webpack.github.io/>`_ and `browserify
46
+
<http://browserify.org/>`_.
36
47
37
48
As an example, we can look at how we used to do things with Sentry (pre-webpack):
38
49
@@ -43,30 +54,38 @@ As an example, we can look at how we used to do things with Sentry (pre-webpack)
43
54
--source-map-url={name}.map.js \
44
55
--source-map={relpath}/{name}.map.js -o {output}
45
56
46
-
We won't attempt to go into the complexities of source maps, so we recommend taking a stab at compiling them, and running them against a validator.
57
+
We won't attempt to go into the complexities of source maps, so we
58
+
recommend taking a stab at compiling them, and running them against a
59
+
validator.
47
60
48
61
Validating a Source Map
49
62
-----------------------
50
63
51
-
We maintain an online validation tool that can be used to test your source (and sourcemaps) against: `sourcemaps.io <http://sourcemaps.io>`_.
64
+
We maintain an online validation tool that can be used to test your source
In many cases your application may sit behind firewalls or you simply can't expose source code to the public. Sentry provides an abstraction called
57
-
**Releases** which you can attach source artifacts to.
70
+
In many cases your application may sit behind firewalls or you simply
71
+
can't expose source code to the public. Sentry provides an abstraction
72
+
called **Releases** which you can attach source artifacts to.
58
73
59
-
The release API is intended to allow you to store source files (and sourcemaps) within Sentry. This removes the requirement for them to be
60
-
web-accessible, and also removes any inconsistency that could come from network flakiness (on either your end, or Sentry's end).
61
-
62
-
* Start by creating a new API key under your organization's API Keys nav (on the home).
74
+
The release API is intended to allow you to store source files (and
75
+
sourcemaps) within Sentry. This removes the requirement for them to be
76
+
web-accessible, and also removes any inconsistency that could come from
77
+
network flakiness (on either your end, or Sentry's end).
63
78
79
+
* Start by creating a new API key under your organization's API Keys nav
80
+
(on the home).
64
81
* Ensure you you have ``project:write`` selected under scopes.
82
+
* You'll use HTTP basic auth with the api key being your username, and an
83
+
empty value for the password.
65
84
66
-
* You'll use HTTP basic auth with the api key being your username, and an empty value for the password.
67
-
68
-
Now you need to setup your build system to create a release, and attach the various source files. You will want to upload all dist
69
-
files (i.e. the minified/shipped JS), the referenced sourcemaps, and the files that those sourcemaps point to.
85
+
Now you need to setup your build system to create a release, and attach
86
+
the various source files. You will want to upload all dist files (i.e. the
87
+
minified/shipped JS), the referenced sourcemaps, and the files that those
88
+
sourcemaps point to.
70
89
71
90
.. code-block:: bash
72
91
@@ -111,22 +130,28 @@ files (i.e. the minified/shipped JS), the referenced sourcemaps, and the files t
111
130
-u [api_key]: \
112
131
-X DELETE
113
132
114
-
Additionally, you'll need to configure [raven-js](https://github.com/getsentry/raven-js) to send the ``release``:
133
+
Additionally, you'll need to configure
134
+
[raven-js](https://github.com/getsentry/raven-js) to send the ``release``:
115
135
116
136
.. code-block:: javascript
117
137
118
138
Raven.config({
119
139
release:'2da95dfb052f477380608d59d32b4ab9'
120
140
});
121
141
122
-
Note: You dont *have* to upload the source files (ref'd by sourcemaps), but without them the grouping algorithm will not be as strong, and the UI will not show any contextual source.
142
+
Note: You dont *have* to upload the source files (ref'd by sourcemaps),
143
+
but without them the grouping algorithm will not be as strong, and the UI
144
+
will not show any contextual source.
123
145
124
-
Additional information can be found in the `Releases API documentation <https://app.getsentry.com/docs/api/releases/>`_.
146
+
Additional information can be found in the `Releases API documentation
147
+
<https://app.getsentry.com/docs/api/releases/>`_.
125
148
126
149
.. sentry:edition:: hosted
127
150
128
151
Working Behind a Firewall
129
152
-------------------------
130
153
131
-
While the recommended solution is to upload your source artifacts to Sentry, sometimes its nescessary to allow communication from Sentry's internal IPs. To
132
-
work around this you can whitelist our :doc:`IP Ranges <../../ip-ranges>`.
154
+
While the recommended solution is to upload your source artifacts to
155
+
Sentry, sometimes its nescessary to allow communication from Sentry's
156
+
internal IPs. To work around this you can whitelist our :doc:`IP
0 commit comments