Repository navigation
chore(server): run the API on Node 24 - #1574
Merged
Merged
Conversation
Node 20 is end of life since 2026-04-30, and Framer's official Server API package (framer-api, for Send to CMS ansvisor#1331) needs Node 22 or later for its global WebSocket. Node 24 is LTS until April 2028. The Dockerfile, CI's server job and the server README move to 24; the web job stays on 20. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 27, 2026
gkhngyk
approved these changes
Oct 27, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
What I checked:
- Dependencies.
- No native addons. In the lockfile, only
esbuild(dev, under vitest) andfsevents(optional, macOS) have install scripts. Every production dependency is plain JavaScript, so nothing is rebuilt for 24. - No
enginesrange in the lockfile leaves 24 out. They're all open-ended. The tightest arecheerio/undici(>=20.18.1) andvite(^20.19.0 || >=22.12.0).
- No native addons. In the lockfile, only
- Node APIs that changed between 20 and 24.
server/srcuses none of them. That means nourl.parse, noBuffer()constructor, nopunycode, noutil.is*, nocrypto.createCipherand no import assertions: JSON is read throughcreateRequire.- No script uses
NODE_OPTIONSor--experimentalflags. - It uses the global
fetchonly, with no undici dispatcher of its own, so moving from undici 6 to 7 doesn't mix two copies. - In the dependencies, pm2's PM2 Plus agent still calls
crypto.createCipher, which is gone since Node 22. It only runs afterpm2 link. If prod is linked to PM2 Plus, check the agent after the deploy.
- The tests on 24.
- I ran the server suite on Node 24.22.0 in a scratch copy, with no env file. Everything passed except the timing tests (the content guards' speed bounds and the 2 MB readability test), which fail on a busy machine.
- The same run on Node 20.18.1 failed the same kind of tests. On 24 those files pass when run alone.
- CI's server job ran on 24.21.0, and all 228 files passed.
- Startup on 24.
- I started
src/server.jswith placeholder settings in development mode.GET /returns the status JSON,GET /t.jsserves the snippet, and Socket.IO answers its handshake. - It also starts under
pm2-runtime(the lockfile's 5.4.3) on 24. pm2 prints oneDeprecationWarning(DEP0176,fs.R_OK) about its own code, as aPM2 error:line. That's noise, not a failure.
- I started
- TLS. Node 24 bundles OpenSSL 3.5, which refuses keys under 2048 bits. Node 20 accepted them; I checked both with a 1024-bit certificate. A customer site or webhook endpoint still on such a key (rare) now fails with
ERR_SSL_EE_KEY_TOO_SMALLorCA_KEY_TOO_SMALLwhere it used to work. - CI.
- setup-node keys npm's download cache on the lockfile, not on the Node version, so the cache carries over.
npm cistill installs fresh on every run. - The web job stays on 20 and runs no server code. Its tests only read server files as text.
- setup-node keys npm's download cache on the lockfile, not on the Node version, so the cache carries over.
- Merge. One commit on 55b49e7 (main), so it merges as is.
- Before the API deploy. Nothing changes for users. No web code depends on this.
At the next API deploy (@gkhngyk):
- Rebuild the image from
server/Dockerfilewithdocker build --pull. TheFROMline changed, so every layer rebuilds: dependencies and the global pm2 install under 24.- If the API host runs Node and pm2 directly instead (say, through
start.sh): install Node 24, thennpm ciandnpm i -g pm2under it. - Then
pm2 killbefore starting.pm2 restartcan keep starting the app with the Node it was first launched with.
- If the API host runs Node and pm2 directly instead (say, through
- This deploy carries more than the runtime. It also ships every server change merged since the API was last deployed.
- Keep the previous image, so rolling back is a container swap.
- If something misbehaves, building the same commit with
FROM node:20tells the runtime apart from the code.
- After it's up, check:
- the log says
server running, andGET /answers; - a tracking run's live progress moves on the dashboard (Socket.IO);
- the next scheduled runs log as before.
- Expect pm2's DEP0176 line. A TLS error on a customer fetch is the item above.
- the log says
- Order. Deploy this before any Framer server change reaches prod.
Follow-ups:
- Pin what the image runs (
server/Dockerfile:1,:13).node:20floated too, so none of this is new.FROM node:24follows every 24.x and the Debian release under it. Pin an exact tag (node:24.<minor>.<patch>-<debian release>) or a digest, and bump it on purpose.npm install -g pm2installs whatever pm2 is newest at build time, not the lockfile's 5.4.3 that I ran on 24. Drop it and start the local one:CMD ["node_modules/.bin/pm2-runtime", "start", "src/server.js"].- Use
npm ci --omit=devin place ofnpm install. That installs the lockfile's exact versions, as CI does, and leaves eslint, vitest and nodemon out of the image.
- Add a
server/.dockerignorewithnode_modules,.envand*.log. Without it,COPY . .(:15) copies the build host'snode_modulesover the ones just installed for 24, and copies the env file into the image. The container already gets its settings fromenv_file. - The other Node version notes.
README.md:145andCONTRIBUTING.md:15still say Node.js >= 20. Say 24 for the server (the web builds on 20). Optionally, add"engines": { "node": ">=24" }toserver/package.json, so npm warns on an older Node onceframer-apiis in.
This was referenced Oct 28, 2026
gkhngyk
pushed a commit
that referenced
this pull request
Oct 29, 2026
The merge of main into #1711 (1530db2) kept the branch's Node 20 lines in the Dockerfile, the server CI job and the README, so #1711's squash (9aab2ae) undid #1574. Framer's client needs Node 22 or newer. Co-authored-by: Cihan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Runs the API server on Node 24 instead of Node 20:
server/Dockerfile:FROM node:24;node-version: 24(the web job stays on 20);server/README.md: Node.js 24 or newer.Why now:
framer-api. That package needs Node 22 or later (engines: >=22), since it connects over the globalWebSocketthat Node 22 added. On Node 20 it can't connect.framer-apiworks on either. Say if you'd rather have 22.Risk:
@gkhngyk, deploy: if the production API isn't built from
server/Dockerfile(a platform's Node setting, for example), it needs Node 24 set there too. The Framer PRs come after this one and need it on the API server.Related issue
Part of #1331 (Send to CMS, phase 2: Framer).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
docker build serverand start it with your.env. The log saysserver running.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)No web code changed. The server's code is unchanged, so its checks are CI's job on Node 24.
🤖 Generated with Claude Code