Buffer equal constant time error #3

Merged
quoije merged 1 commits from cursor/buffer-equal-constant-time-error-7053 into prod 2025-12-20 17:26:49 -05:00
4 changed files with 47 additions and 0 deletions
Showing only changes of commit 5abe54be6e - Show all commits
+1
View File
@@ -0,0 +1 @@
22
+3
View File
@@ -6,6 +6,9 @@ Would probably need to revamp everything, but didn't want to spend more time on
![Oscars Pool 2025](https://github.com/quoije/oscar-pool/blob/prod/img/preview.png) ![Oscars Pool 2025](https://github.com/quoije/oscar-pool/blob/prod/img/preview.png)
## Setup ## Setup
### Node version
Use **Node.js LTS (18/20/22)**. Node 23+ (e.g. Node 25) is currently not supported due to a transitive dependency used by `jsonwebtoken`.
Config those in your .env file: Config those in your .env file:
**DOG_NAMES=**`woof, WOOF, Woof` &nbsp;&nbsp;&nbsp;&nbsp;(for "verification")<br> **DOG_NAMES=**`woof, WOOF, Woof` &nbsp;&nbsp;&nbsp;&nbsp;(for "verification")<br>
+4
View File
@@ -3,12 +3,16 @@
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"preinstall": "node ./scripts/check-node-version.js",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"description": "", "description": "",
"engines": {
"node": ">=18 <23"
},
"dependencies": { "dependencies": {
"axios": "^1.7.9", "axios": "^1.7.9",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
+39
View File
@@ -0,0 +1,39 @@
/**
* This project currently relies on transitive deps (via jsonwebtoken/jws/jwa)
* that are not yet compatible with Node 23+ (e.g. Node 25 removes SlowBuffer).
*
* Render (and most production platforms) typically run an LTS release (18/20/22).
* If you're using a "Current" Node locally, pin to an LTS to avoid install/runtime issues.
*/
const nodeVersion = process.versions.node || "";
const major = Number(String(nodeVersion).split(".")[0]);
if (!Number.isFinite(major)) {
console.error(
`[preinstall] Could not parse Node version: "${nodeVersion}". ` +
"Please use Node 18/20/22 (LTS).",
);
process.exit(1);
}
if (major >= 23) {
console.error(
[
`[preinstall] Unsupported Node.js version detected: v${nodeVersion}`,
"",
"This project currently requires an LTS Node release (18/20/22).",
"Reason: a transitive dependency uses APIs removed/changed in Node 23+",
'(commonly seen as "buffer-equal-constant-time" failing on SlowBuffer).',
"",
"Fix (Windows):",
"- Install/use Node 22 LTS (recommended) or Node 20 LTS",
"- Reinstall deps: delete node_modules + package-lock.json, then `npm install`",
"",
"Fix (macOS/Linux):",
"- `nvm install 22 && nvm use 22` (or `nvm install 20 && nvm use 20`)",
"",
].join("\n"),
);
process.exit(1);
}