message: ref: Use domain Hub detection only in Node environment
diff: @@ -10,7 +10,7 @@ import {
  Severity,
  User,
  } from '@sentry/types';
  -import { consoleSandbox, dynamicRequire, getGlobalObject, logger, uuid4 } from '@sentry/utils';
  +import { consoleSandbox, dynamicRequire, getGlobalObject, isNodeEnv, logger, uuid4 } from '@sentry/utils';
  import { Carrier, Layer } from './interfaces';
  import { Scope } from './scope';
  @@ -422,7 +422,19 @@ export function getCurrentHub(): Hub {
  setHubOnCarrier(registry, new Hub());
  }
  - // Prefer domains over global if they are there
  + // Prefer domains over global if they are there (applicable only to Node environment)
  + if (isNodeEnv()) {
  + return getHubFromActiveDomain(registry);
  + }
  + // Return hub that lives on a global object
  + return getHubFromCarrier(registry);
  +}
  +
  +/**
  + * Try to read the hub from an active domain, fallback to the registry if one doesnt exist
  + * @returns discovered hub
  + */
  +function getHubFromActiveDomain(registry: Carrier): Hub {
  try {
  // We need to use `dynamicRequire` because `require` on it's own will be optimized by webpack.
  // We do not want this to happen, we need to try to `require` the domain node module and fail if we are in browser
  