@sockethub/server 5.0.0-alpha.21 → 5.0.0-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/platform.js CHANGED
@@ -26685,7 +26685,7 @@ var init_package = __esm(() => {
26685
26685
  package_default = {
26686
26686
  name: "@sockethub/schemas",
26687
26687
  description: "JSON schema files for validating Sockethub Activity Streams",
26688
- version: "3.0.0-alpha.21",
26688
+ version: "3.0.0-alpha.23",
26689
26689
  type: "module",
26690
26690
  private: false,
26691
26691
  author: "Nick Jennings <nick@silverbucket.net>",
@@ -26755,7 +26755,7 @@ var init_package = __esm(() => {
26755
26755
  "ajv-formats": "^2.1.1",
26756
26756
  "ajv-formats-draft2019": "^1.6.1"
26757
26757
  },
26758
- gitHead: "683f7b2c0cda2eda05c845eb98827cf13d055eb4",
26758
+ gitHead: "a6d303097640e82c7d1a7cef6dea2e6dae5f2cac",
26759
26759
  types: "./dist/index.d.ts"
26760
26760
  };
26761
26761
  });
@@ -27072,6 +27072,11 @@ var init_sockethub_config = __esm(() => {
27072
27072
  default: 262144,
27073
27073
  description: "Maximum size in bytes of a single Socket.IO message."
27074
27074
  },
27075
+ trustProxy: {
27076
+ type: ["boolean", "number", "string"],
27077
+ default: false,
27078
+ description: "Express 'trust proxy' setting, deciding whether " + "'x-forwarded-for' is believed when determining a " + "client's IP for HTTP rate limiting. false trusts no " + "proxy; a number trusts that many hops; a string " + "takes an address, subnet or preset ('loopback'). " + "Only enable behind a reverse proxy that overwrites " + "the header. When left false while " + "credentialCheck.reconnectIpSource is 'proxy' and " + "credentialCheck.proxyHeader is 'x-forwarded-for', " + "one hop is trusted so both paths agree; a custom " + "proxyHeader requires setting this explicitly."
27079
+ },
27075
27080
  cors: {
27076
27081
  type: "object",
27077
27082
  additionalProperties: false,
@@ -73853,6 +73858,11 @@ var init_config_schema = __esm(() => {
73853
73858
  env: "SOCKETHUB_MAX_PAYLOAD_BYTES",
73854
73859
  emptyEnvIsUnset: true
73855
73860
  },
73861
+ "sockethub.trustProxy": {
73862
+ format: "*",
73863
+ env: "SOCKETHUB_TRUST_PROXY",
73864
+ emptyEnvIsUnset: true
73865
+ },
73856
73866
  "sockethub.cors.origin": {
73857
73867
  env: "SOCKETHUB_CORS_ORIGIN",
73858
73868
  arg: "cors.origin"
@@ -115177,7 +115187,9 @@ var init_esm7 = __esm(() => {
115177
115187
  // src/sentry.ts
115178
115188
  var exports_sentry = {};
115179
115189
  __export(exports_sentry, {
115190
+ SENTRY_FLUSH_TIMEOUT_MS: () => SENTRY_FLUSH_TIMEOUT_MS,
115180
115191
  count: () => count2,
115192
+ flush: () => flush3,
115181
115193
  gauge: () => gauge2,
115182
115194
  reportError: () => reportError,
115183
115195
  sendTestEvent: () => sendTestEvent,
@@ -115187,6 +115199,9 @@ function reportError(err) {
115187
115199
  logger2.warn("reporting error");
115188
115200
  captureException(err);
115189
115201
  }
115202
+ function flush3(timeoutMs = SENTRY_FLUSH_TIMEOUT_MS) {
115203
+ return flush(timeoutMs);
115204
+ }
115190
115205
  function count2(name, value = 1, attributes = {}) {
115191
115206
  if (sentryConfig.enableMetrics) {
115192
115207
  exports_public_api.count(name, value, { attributes });
@@ -115223,7 +115238,7 @@ async function sendTestEvent() {
115223
115238
  captureMessage("Sockethub Sentry verification event", "info");
115224
115239
  return flush(5000);
115225
115240
  }
115226
- var logger2, sentryConfig, integrations;
115241
+ var SENTRY_FLUSH_TIMEOUT_MS = 2000, logger2, sentryConfig, integrations;
115227
115242
  var init_sentry = __esm(async () => {
115228
115243
  init_esm5();
115229
115244
  init_src();
@@ -136782,12 +136797,16 @@ async function startPlatformProcess() {
136782
136797
  });
136783
136798
  }
136784
136799
  };
136785
- (async () => {
136786
- if (resolveSentryConfig().dsn) {
136787
- logger3.info("initializing sentry");
136788
- sentry = await init_sentry().then(() => exports_sentry);
136789
- }
136790
- })();
136800
+ process.once("uncaughtException", (err) => {
136801
+ reportFatal(toError(err));
136802
+ });
136803
+ process.once("unhandledRejection", (err) => {
136804
+ reportFatal(toError(err));
136805
+ });
136806
+ if (resolveSentryConfig().dsn) {
136807
+ logger3.info("initializing sentry");
136808
+ sentry = await init_sentry().then(() => exports_sentry);
136809
+ }
136791
136810
  let jobWorker;
136792
136811
  let jobWorkerStarted = false;
136793
136812
  let parentSecret1;
@@ -136865,22 +136884,21 @@ async function startPlatformProcess() {
136865
136884
  function isPersistentPlatform(platform4) {
136866
136885
  return platform4.config.persist === true;
136867
136886
  }
136868
- process.once("uncaughtException", (err) => {
136869
- console.log("EXCEPTION IN PLATFORM");
136870
- sentry.reportError(err);
136871
- console.log(`error:
136872
- `, err.stack);
136873
- safeProcessSend(["error", err.toString()]);
136874
- process.exit(1);
136875
- });
136876
- process.once("unhandledRejection", (err) => {
136887
+ async function reportFatal(err) {
136877
136888
  console.log("EXCEPTION IN PLATFORM");
136878
136889
  sentry.reportError(err);
136879
136890
  console.log(`error:
136880
136891
  `, err.stack);
136881
136892
  safeProcessSend(["error", err.toString()]);
136893
+ try {
136894
+ if (await sentry.flush?.() === false) {
136895
+ console.error(`fatal-error-flush timed out for ${platformName} ${identifier}; event may be lost`);
136896
+ }
136897
+ } catch (flushErr) {
136898
+ console.error(`fatal-error-flush failed for ${platformName} ${identifier}: ${errorMessage(flushErr)}`);
136899
+ }
136882
136900
  process.exit(1);
136883
- });
136901
+ }
136884
136902
  process.on("disconnect", () => {
136885
136903
  console.log(`Parent disconnected. Child ${process.pid} exiting.`);
136886
136904
  process.exit(1);
@@ -137059,4 +137077,4 @@ export {
137059
137077
  mergePackageConfig
137060
137078
  };
137061
137079
 
137062
- //# debugId=EE1E92BCF7ECF0AB64756E2164756E21
137080
+ //# debugId=3A4E6CD71F708B7C64756E2164756E21