Skip to content

chore(server): run the API on Node 24 - #1574

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:chore/server-node-24
Oct 28, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:chore/server-node-24

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Runs the API server on Node 24 instead of Node 20:

  • server/Dockerfile: FROM node:24;
  • CI's server job: node-version: 24 (the web job stays on 20);
  • server/README.md: Node.js 24 or newer.

Why now:

  • Node 20 reached end of life on 2026-04-30. It gets no more security fixes.
  • Send to CMS → Framer (Send content from the Content Editor and Library to a CMS (webhook first, then WordPress and Webflow) #1331) needs Node 22 or later. The user chose a native Framer connector over a workflow guide. It uses Framer's official Server API package, framer-api. That package needs Node 22 or later (engines: >=22), since it connects over the global WebSocket that Node 22 added. On Node 20 it can't connect.
  • Node 24 over 22. Node 24 is an LTS release, supported until April 2028; Node 22 ends in April 2027. framer-api works on either. Say if you'd rather have 22.

Risk:

  • The server has no native modules. All of its dependencies are plain JavaScript, so nothing needs rebuilding.
  • Locally, the server's tests already pass on Node 26.
  • CI runs them on 24 with this PR.

@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 feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  • CI's server — lint, format & test job runs on Node 24 and passes.
  • Optional: docker build server and start it with your .env. The log says server running.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

No web code changed. The server's code is unchanged, so its checks are CI's job on Node 24.

🤖 Generated with Claude Code

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]>

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with follow-ups.

What I checked:

  • Dependencies.
    • No native addons. In the lockfile, only esbuild (dev, under vitest) and fsevents (optional, macOS) have install scripts. Every production dependency is plain JavaScript, so nothing is rebuilt for 24.
    • No engines range in the lockfile leaves 24 out. They're all open-ended. The tightest are cheerio/undici (>=20.18.1) and vite (^20.19.0 || >=22.12.0).
  • Node APIs that changed between 20 and 24.
    • server/src uses none of them. That means no url.parse, no Buffer() constructor, no punycode, no util.is*, no crypto.createCipher and no import assertions: JSON is read through createRequire.
    • No script uses NODE_OPTIONS or --experimental flags.
    • It uses the global fetch only, 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 after pm2 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.js with placeholder settings in development mode. GET / returns the status JSON, GET /t.js serves the snippet, and Socket.IO answers its handshake.
    • It also starts under pm2-runtime (the lockfile's 5.4.3) on 24. pm2 prints one DeprecationWarning (DEP0176, fs.R_OK) about its own code, as a PM2 error: line. That's noise, not a failure.
  • 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_SMALL or CA_KEY_TOO_SMALL where 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 ci still installs fresh on every run.
    • The web job stays on 20 and runs no server code. Its tests only read server files as text.
  • 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):

  1. Rebuild the image from server/Dockerfile with docker build --pull. The FROM line 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, then npm ci and npm i -g pm2 under it.
    • Then pm2 kill before starting. pm2 restart can keep starting the app with the Node it was first launched with.
  2. 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:20 tells the runtime apart from the code.
  3. After it's up, check:
    • the log says server running, and GET / 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.
  4. Order. Deploy this before any Framer server change reaches prod.

Follow-ups:

  1. Pin what the image runs (server/Dockerfile:1, :13). node:20 floated too, so none of this is new.
    • FROM node:24 follows 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 pm2 installs 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=dev in place of npm install. That installs the lockfile's exact versions, as CI does, and leaves eslint, vitest and nodemon out of the image.
  2. Add a server/.dockerignore with node_modules, .env and *.log. Without it, COPY . . (:15) copies the build host's node_modules over the ones just installed for 24, and copies the env file into the image. The container already gets its settings from env_file.
  3. The other Node version notes. README.md:145 and CONTRIBUTING.md:15 still say Node.js >= 20. Say 24 for the server (the web builds on 20). Optionally, add "engines": { "node": ">=24" } to server/package.json, so npm warns on an older Node once framer-api is in.

@gkhngyk
gkhngyk merged commit 90b8636 into ansvisor:main Oct 28, 2026
6 checks passed
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants