fix: prevent the app from crashing due to a strict mode exception (#1011)

The api throws 504 and hangs when invalid credentials are given on login page.
> {"level":"error","message":"'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them","name":"TypeError","stack":"TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them\n    at i (/app/packages/api/index.js:335:35331)\n    at new i (/app/packages/api/index.js:335:35235)\n    at PBKDF2Job.<anonymous> (/app/packages/api/index.js:335:38225)\n    
at job.ondone (node:internal/crypto/pbkdf2:56:12)"

The root cause is due to the strict mode enforced by the esbuild. The fix here is to fork the `passport-local-mongoose` and fix the part that causes the error (edb1149704)

Ref: HDX-2036
This commit is contained in:
Warren 2025-07-23 10:55:03 -07:00 committed by GitHub
parent c8729b8479
commit 21b5df66aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 22 deletions

View file

@ -0,0 +1,5 @@
---
"@hyperdx/api": patch
---
fix: Hotfix to prevent the app from crashing due to a strict mode exception

View file

@ -11,6 +11,7 @@
"@hyperdx/common-utils": "^0.2.6",
"@hyperdx/lucene": "^3.1.1",
"@hyperdx/node-opentelemetry": "^0.8.2",
"@hyperdx/passport-local-mongoose": "^9.0.1",
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/host-metrics": "^0.35.5",
"@opentelemetry/sdk-metrics": "^1.30.1",
@ -41,7 +42,6 @@
"on-headers": "^1.0.2",
"passport": "^0.6.0",
"passport-local": "^1.0.0",
"passport-local-mongoose": "^6.1.0",
"pluralize": "^8.0.0",
"promised-handlebars": "^2.0.1",
"protobufjs": "^7.5.2",

View file

@ -1,6 +1,6 @@
import mongoose, { Schema } from 'mongoose';
// @ts-ignore don't install the @types for this package, as it conflicts with mongoose
import passportLocalMongoose from 'passport-local-mongoose';
import passportLocalMongoose from '@hyperdx/passport-local-mongoose';
import mongoose, { Schema } from 'mongoose';
import { v4 as uuidv4 } from 'uuid';
type ObjectId = mongoose.Types.ObjectId;

View file

@ -4447,6 +4447,7 @@ __metadata:
"@hyperdx/common-utils": "npm:^0.2.6"
"@hyperdx/lucene": "npm:^3.1.1"
"@hyperdx/node-opentelemetry": "npm:^0.8.2"
"@hyperdx/passport-local-mongoose": "npm:^9.0.1"
"@opentelemetry/api": "npm:^1.8.0"
"@opentelemetry/host-metrics": "npm:^0.35.5"
"@opentelemetry/sdk-metrics": "npm:^1.30.1"
@ -4502,7 +4503,6 @@ __metadata:
on-headers: "npm:^1.0.2"
passport: "npm:^0.6.0"
passport-local: "npm:^1.0.0"
passport-local-mongoose: "npm:^6.1.0"
pluralize: "npm:^8.0.0"
promised-handlebars: "npm:^2.0.1"
protobufjs: "npm:^7.5.2"
@ -4834,6 +4834,16 @@ __metadata:
languageName: node
linkType: hard
"@hyperdx/passport-local-mongoose@npm:^9.0.1":
version: 9.0.1
resolution: "@hyperdx/passport-local-mongoose@npm:9.0.1"
dependencies:
passport-local: "npm:^1.0.0"
scmp: "npm:^2.1.0"
checksum: 10c0/beba3eae1c827609ad2318f5660e6e91d9195430ed00d807570a63eca82cc1bf123d19ad5526d9855ecdf2c376348f28f0bda411f1dc33eb1b56316e3699c3d3
languageName: node
linkType: hard
"@img/sharp-darwin-arm64@npm:0.33.4":
version: 0.33.4
resolution: "@img/sharp-darwin-arm64@npm:0.33.4"
@ -17207,13 +17217,6 @@ __metadata:
languageName: node
linkType: hard
"generaterr@npm:^1.5.0":
version: 1.5.0
resolution: "generaterr@npm:1.5.0"
checksum: 10c0/4aaeea63672abd3d3301ffbc1387ed8532efb522e5afd86b9ed3ea8fbedd78df134670ed4a439dd1b439e119e3f6ca6f0bd51ff9b1a1875d8eeb04e1b59c3a33
languageName: node
linkType: hard
"gensync@npm:^1.0.0-beta.2":
version: 1.0.0-beta.2
resolution: "gensync@npm:1.0.0-beta.2"
@ -23334,17 +23337,6 @@ __metadata:
languageName: node
linkType: hard
"passport-local-mongoose@npm:^6.1.0":
version: 6.3.0
resolution: "passport-local-mongoose@npm:6.3.0"
dependencies:
generaterr: "npm:^1.5.0"
passport-local: "npm:^1.0.0"
scmp: "npm:^2.1.0"
checksum: 10c0/2be9d4458ce7dbe29ab2508ea98d75744d54c63a4cb5d06dd7bbc6a8aaf20501c9320dc2d5105a95ada971f2ded669c18d420578d7408a2b9af9c6b8d807c0a2
languageName: node
linkType: hard
"passport-local@npm:^1.0.0":
version: 1.0.0
resolution: "passport-local@npm:1.0.0"