Data Source Name (DSN)
Sentry automatically assigns you a Data Source Name (
What the DSN Does
A
If this value is not provided, SDKs will try to read it from the SENTRY_DSN
environment variable, where applicable. This fallback does not apply in cases like a web browser, where the concept of environment variables does not exist.
If an SDK is not initialized or if it is initialized with an empty DSN, the SDK will not send any data over the network, such as captured exceptions.
DSN Utilization
DSNs are safe to keep public because they only allow submission of new events and related event data; they do not allow read access to any information.
While there is a risk of abusing a
If your application is shipped to client devices, if possible, we recommend having a way to configure the DSN dynamically. In an ideal scenario, you can "ship" a new DSN to your application without the customer downloading the latest version. We recognize that this may not always be practical, but we cannot offer further advice as this scenario is implementation specific.
Where to Find Your DSN
If you're in the process of setting up a
You can also find the DSN in your project settings by navigating to [Project] > Settings > Client Keys (DSN) in sentry.io.
The Parts of the DSN
The
{PROTOCOL}://{PUBLIC_KEY}:{SECRET_KEY}@{HOST}{PATH}/{PROJECT_ID}
For example:
Sentry.init({ dsn: "https://public@sentry.example.com/1" });
Has the following settings:
- URI = https://sentry.example.com
- Public Key = public
- Project ID = 1
The secret part of the DSN is optional and effectively deprecated. While clients will still honor it, if supplied, future versions of Sentry will entirely ignore it.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").