-
Notifications
You must be signed in to change notification settings - Fork 48

Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/angular
SDK Version
7.59.3
Framework Version
Angular v15.2.0, Node v16.13.1 (also tried with Node v18)
Link to Sentry event
No response
SDK Setup
const packageJson = require('../package.json');
let appVersion;
switch (environment.name) {
case 'stage':
appVersion = packageJson.stageVersion;
break;
case 'dev':
appVersion = packageJson.devVersion;
break;
case 'prod':
appVersion = packageJson.version;
break;
}
try {
Sentry.init({
environment: environment.name,
enabled: environment.sentry.enabled,
dsn: environment.sentry.cdn,
release: `${process.env.npm_package_name}@${appVersion}`,
debug: environment.sentry.debug,
integrations: [
new Sentry.BrowserTracing({
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: environment.sentry.tracePropagationTargets,
routingInstrumentation: Sentry.routingInstrumentation,
beforeNavigate: (context) => {
return {
...context,
name: location.pathname.replace(UUID_REGEX, '/<hash>')
};
},
}),
new Sentry.Replay(),
],
// Performance Monitoring
tracesSampleRate: environment.sentry.tracesSampleRate, // Capture 100% of the transactions, reduce in production!
// Session Replay
replaysSessionSampleRate: environment.sentry.replaysSessionSampleRate, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: environment.sentry.replaysOnErrorSampleRate, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
const activeTransaction = Sentry.getActiveTransaction();
bootstrapSpan = activeTransaction
&& activeTransaction.startChild({
description: 'platform-browser-dynamic',
op: 'ui.angular.bootstrap',
});
} catch (err) {
console.error(err);
}
env
export const environment = {
name: 'dev',
sentry: {
enabled: false,
cdn: 'url_to_cdn',
debug: true,
tracePropagationTargets: ['devUrl', 'devApiUrl'],
tracesSampleRate: 1,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
}
};
Steps to Reproduce
I use custom-webpack with Angular with 3 environments. But currently I'm applying Dev env only
angular.json
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"mergeRules": {
"externals": "replace"
},
"replaceDuplicatePlugins": true
}
},
"configurations": {
"production": {
"customWebpackConfig": {
"path": "custom-webpack.config.prod.js"
}
},
"stage": {
"customWebpackConfig": {
"path": "custom-webpack.config.stage.js"
}
},
"dev": {
"customWebpackConfig": {
"path": "custom-webpack.config.dev.js"
}
}
}
}
}
custom-webpack.config.dev.js
const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");
const packageJson = require('./package.json');
module.exports = {
devtool: "source-map", // Source map generation must be turned on
plugins: [
sentryWebpackPlugin({
org: "myOrgName",
project: "myProjectName",
release: {
name: `${process.env.npm_package_name}@${packageJson.devVersion}`
},
authToken: "myAuthToken",
}),
],
};
When I run: npm start run build-dev
with config in package.json
"build-dev": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --configuration=dev"
Sometimes it shows error An unhandled exception occurred: socket hang up
with log detail:
Sometimes it shows error Client network socket disconnected before secure TLS connection was established
with log detail:
Sometimes it builds successfully but it stuck at the last step after building success Build at: 2023-07-21T09:55:15.124Z - Hash: a86f2728c9b24f07 - Time: 57608ms
But when I tried with another plugin, it worked perfectly. Then I back to sentry plugins, it happened again
Expected Result
Build successfully without being stuck and errors
Actual Result
Images above
Metadata
Metadata
Assignees
Labels
Projects
Status