
Security News
Scaling Socket from Zero to 10,000+ Organizations
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.
@labor-digital/sentry-browser
Advanced tools
A convenience wrapper around the sentry.io browser api - Probably mostly for company internal affairs ;)
This package is a wrapper for the sentry.io SDK. It integrates into the asset-building toolbox to automagically inject the required DSN into your codebase.
This is mostly an internal tool we use in combination with our bitbucket build-pipelines. However, you can also use the library without any build-pipeline (See "Without pipeline" for further details).
Install this package using npm:
npm install @labor-digital/sentry-browser
Register the extension for the asset-builder
{
"labor": {
"apps": [...],
"extensions": [
"@labor-digital/sentry-browser/asset-building"
]
}
}
In your frontend code you can now simply import the Sentry class from the package. The injection of all required information will be handled by our build-pipeline. (See "Without pipeline" for usage without build pipeline)
import Sentry from "@labor-digital/sentry-browser"
try {
... Your Code ...
} catch(e){
Sentry.captureException(e);
}
If you can't, or don't want to use our bitbucket pipeline you have to manually inject the configuration into the script.
You can do that by manually setting the configuration in your code using Sentry.setSentryConfig(),
or by injecting the process.env.LABOR_SENTRY_CONFIG environment variable using webpack's "Define Plugin" in your build process.
const sentryConfig = {
dsn: "$YOUR_DSN", // This is the dsn you get from the sentry website or using the CLI
release: "$YOUR_RELEASE", // This is optional to use sentry's release feature
};
module.exports = merge($WEBPACK_CONFIG, {
plugins: [
new (require("webpack")).DefinePlugin({
"process.env.LABOR_SENTRY_CONFIG": JSON.stringify(sentryConfig)
})
]
});
If you are using custom error objects, that hold additional data you want to provide to sentry, this package has you covered. By default, you would have to add a beforeSend() hook to inject your data before sentry sends the data to the api.
With this package you can simply add a method called getSentryExtra() to your error object. The method can either return a promise, or a simple object that will automatically be added to the error when the request is send.
Captures an exception event and sends it to Sentry.
Captures a message event and sends it to Sentry.
We use NODE_ENV === "production" to automatically detect if sentry logging should be enabled. If you want to force the activity state you can always use this method to set the activity manually. Keep in mind, that even if you set this to TRUE, but your configuration is incomplete nothing will be logged!
By default, the class will try to load the basic configuration using the config.json file that was generated by the sentry-release build step, but you may use this method either to provide additional configuration for sentry or to provide the whole configuration without using the build step.
Checks if the sentry logging is activated, by validating if the class was correctly initialized
npm installnpm run watchnpm run buildYou're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: LABOR.digital - Fischtorplatz 21 - 55116 Mainz, Germany
We publish all received postcards on our company website.
FAQs
A convenience wrapper around the sentry.io browser api - Probably mostly for company internal affairs ;)
We found that @labor-digital/sentry-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.

Research
Socket Threat Research maps a rare inside look at OtterCookie’s npm-Vercel-GitHub chain, adding 197 malicious packages and evidence of North Korean operators.

Research
Socket researchers identified a malicious Chrome extension that manipulates Raydium swaps to inject an undisclosed SOL transfer, quietly routing fees to an attacker wallet.