Node.js 22 serverless functions with native modules and warm pools
Node.js 22 serverless functions run in isolated containers—full npm ecosystem, native addons, and ES2024 features without V8 isolate restrictions. Connect functions to HTTP routes, webhook ingress, or pipeline steps, and configure recurring runs on the pipeline from the same workspace.
Last updated: 2026-06-28
Answer first
Direct answer
Node.js 22 serverless functions with native modules and warm pools. Inquir runs Node.js 22 in Docker containers—the same Node.js you use locally, with the same native module support. Declare dependencies in package.json; attach layers for native addons—the platform bundles the deploy artifact.
When it fits
- Your handler uses native npm packages (sharp, bcrypt, grpc) that require a real Node.js container.
- You want HTTP API endpoints, webhook handlers, and scheduled or background pipelines to share one Node.js function catalog.
Tradeoffs
- Lambda gives you full Node.js but the operator cost of API Gateway + CloudWatch + IAM roles is non-trivial for small teams.
- Edge runtimes are fast globally but you lose native modules and anything that needs a real POSIX environment.
Workload and what breaks
Where edge runtimes limit Node.js
Edge serverless runtimes (Cloudflare Workers, Vercel Edge Functions) run a subset of Node.js inside V8 isolates. Native addons like sharp, bcrypt, and grpc-node, filesystem access, subprocess calls, and private network connections are all restricted or unavailable.
Lambda-style platforms like AWS Lambda support full Node.js but require assembling API Gateway, EventBridge, CloudWatch, and Layers yourself before the first function sees traffic.
Trade-offs
Why Lambda and edge both miss something
Lambda gives you full Node.js but the operator cost of API Gateway + CloudWatch + IAM roles is non-trivial for small teams.
Edge runtimes are fast globally but you lose native modules and anything that needs a real POSIX environment.
How Inquir helps
Full Node.js 22 behind a single gateway
Inquir runs Node.js 22 in Docker containers—the same Node.js you use locally, with the same native module support. Declare dependencies in package.json; attach layers for native addons—the platform bundles the deploy artifact.
HTTP routes, webhook handlers, and pipeline steps all call the same Node.js function IDs. Schedules trigger pipelines, whose steps reuse those functions. One deploy, one secrets model, one execution history.
What you get
Node.js 22 runtime capabilities
Full npm ecosystem
sharp, bcrypt, better-sqlite3, grpc, canvas, and any native addon that compiles against Node.js 22 work without shimming.
ES2024 and top-level await
Use the latest ECMAScript features, ESM imports, and top-level await in .mjs handlers without transpilation.
Hot containers for steady traffic
Enable warm pools to pre-warm Node.js containers—cuts p99 latency on busy HTTP routes and agent tool loops.
Gateway and pipelines in one
Reuse the same function in HTTP routes and pipeline steps. Pipelines can run on a schedule or continue work in the background.
What to do next
How to deploy a Node.js serverless function
Write your handler
Export an async handler(event) function from a .mjs file. Use ESM imports. Event shape matches AWS Lambda HTTP events for compatibility.
Declare dependencies
Add npm packages to package.json. Native addons compile during deploy—attach a layer when the package needs a separate build step; no Dockerfile required.
Connect routes and pipeline steps
Attach the function to a gateway HTTP route or a pipeline step. Configure schedules and background execution on the pipeline, reusing the same handler.
Code example
HTTP handler with native module
The gateway passes an HTTP-shaped event: path, headers, body (string), queryStringParameters. Return statusCode + body. Native modules like sharp work because the runtime is a real container.
import sharp from 'sharp'; // native module — works in containers, not in edge isolates export async function handler(event) { const params = event.queryStringParameters ?? {}; const width = Number(params.width ?? 320); const height = Number(params.height ?? 240); if (!event.body) return { statusCode: 400, body: JSON.stringify({ error: 'body required' }) }; const input = Buffer.from(event.body, 'base64'); const resized = await sharp(input).resize(width, height).jpeg({ quality: 85 }).toBuffer(); return { statusCode: 200, headers: { 'Content-Type': 'image/jpeg' }, body: resized.toString('base64'), isBase64Encoded: true, }; }
When it fits
Best fit for Node.js 22 serverless functions
When this works
- Your handler uses native npm packages (sharp, bcrypt, grpc) that require a real Node.js container.
- You want HTTP API endpoints, webhook handlers, and scheduled or background pipelines to share one Node.js function catalog.
When to skip it
- Tiny, pure-JS logic that benefits from running at hundreds of edge POPs for global millisecond latency—use a V8-isolate edge runtime for that.
FAQ
FAQ
Which Node.js version does Inquir use?
Node.js 22. ESM (.mjs), CommonJS (.cjs), and TypeScript (compiled before deploy) are all supported.
Can I use ES modules (import/export)?
Yes. Name files .mjs or set "type": "module" in package.json. Top-level await works in ESM handlers.
How do I handle binary uploads through the gateway?
Binary bodies arrive as base64-encoded strings when the gateway receives binary content. Decode with Buffer.from(event.body, "base64") before processing.