-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Add Node.js as a supported runtime alongside Deno and Bun.
Motivation
- Many npm packages still assume "real Node" and may have quirks with Bun/Deno
- High compatibility with existing JavaScript/TypeScript ecosystem
- Low implementation effort since npm dependency flow already exists
Implementation Plan
1. Extend Runtime enum and image selection
- Add
RuntimeNode Runtime = "node"tomodels/models.go - Add
RUNTIME_IMAGE_NODEenv var support inexecutor/docker.go
2. Create Node Dockerfile (services/runtime-node/Dockerfile)
FROM node:20-alpine
RUN addgroup -g 1000 nodeuser && \
adduser -D -u 1000 -G nodeuser nodeuser
USER nodeuser
WORKDIR /workspace
COPY --chown=nodeuser:nodeuser runner.mjs /runtime/runner.mjs
ENTRYPOINT ["node", "/runtime/runner.mjs"]3. Create Node runner (services/runtime-node/runner.mjs)
- Read stdin JSON (ExecutionInput)
- Set
process.envfromevent.env - Dynamic import user module from
/workspace/${mainModule} - Call
await module.handler(event, context) - Capture console methods for log collection
- Output ExecutionOutput JSON to stdout
4. Add dependency installation
- Add
installNodeDependencies()function inexecutor/docker.go - Use
npm installsimilar to how Bun usesbun add
Effort Estimate
~0.5-1 day
Acceptance Criteria
-
runtime: "node"accepted in setup request - Node.js handler functions execute correctly
- npm dependencies install and are available at runtime
- Console logs are captured
- Works with gVisor sandboxing
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels