Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott

## 5.15.2

- [hub] fix: Remove dynamicRequire, Fix require call (#2521)

## 5.15.1

- [browser] fix: Prevent crash for react native instrumenting fetch (#2510)
Expand Down
3 changes: 2 additions & 1 deletion packages/hub/src/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ export function getCurrentHub(): Hub {
*/
function getHubFromActiveDomain(registry: Carrier): Hub {
try {
const domain = require('domain');
const req = require;
const domain = req('domain');
const activeDomain = domain.active;

// If there no active domain, just return global hub
Expand Down
3 changes: 2 additions & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@
"fix": "run-s fix:tslint fix:prettier",
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
"fix:tslint": "tslint --fix -t stylish -p .",
"test": "run-s test:jest test:express",
"test": "run-s test:jest test:express test:webpack",
"test:jest": "jest",
"test:watch": "jest --watch",
"test:express": "node test/manual/express-scope-separation/start.js",
"test:webpack": "cd test/manual/webpack-domain/ && yarn && yarn webpack && node dist/bundle.js",
"version": "node ../../scripts/versionbump.js src/version.ts"
},
"jest": {
Expand Down
1 change: 1 addition & 0 deletions packages/node/test/manual/webpack-domain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
53 changes: 53 additions & 0 deletions packages/node/test/manual/webpack-domain/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import * as Sentry from '@sentry/node';

let remaining = 2;

class DummyTransport {
sendEvent(event) {
--remaining;

if (!remaining) {
console.error('SUCCESS: Webpack Node Domain test OK!');
process.exit(0);
}

return Promise.resolve({
status: 'success',
});
}
}

Sentry.init({
dsn: 'https://[email protected]/1',
transport: DummyTransport,
beforeSend(event) {
if (event.message === 'inside') {
if (event.tags.a !== 'x' && event.tags.b !== 'c') {
console.error('FAILED: Scope contains incorrect tags');
process.exit(1);
}
}
if (event.message === 'outside') {
if (event.tags.a !== 'b') {
console.error('FAILED: Scope contains incorrect tags');
process.exit(1);
}
}
return event;
},
});

Sentry.configureScope(scope => {
scope.setTag('a', 'b');
});

const d = require('domain').create();
d.run(() => {
Sentry.configureScope(scope => {
scope.setTag('a', 'x');
scope.setTag('b', 'c');
});
Sentry.captureMessage('inside');
});

Sentry.captureMessage('outside');
13 changes: 13 additions & 0 deletions packages/node/test/manual/webpack-domain/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "webpack-domain",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@sentry/node": "../../../",
"webpack": "^4.42.1"
},
"devDependencies": {
"webpack-cli": "^3.3.11"
}
}
10 changes: 10 additions & 0 deletions packages/node/test/manual/webpack-domain/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path');

module.exports = {
entry: './index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
target: "node",
};
Loading