Apart from API Maker
An endless loop, a crash or a memory leak in your code stays in its container. API Maker keeps serving the other requests.
API Maker
The framework for AI era
Security
Your code runs in Docker containers, apart from API Maker, with time limits and automatic replacement.
Custom APIs, hooks, event listeners, schedulers, migrations and test cases run in sandbox containers, not in the API Maker process. Every run has a time limit, a stuck sandbox is replaced, and each account builds its own image with the npm packages it needs.
Step through it, slow it down, or open the full canvas.
Your code runs outside API Maker. Custom APIs, hooks, event listeners, schedulers, migrations and test cases run in Docker containers. The worker sends the code and the request over TCP and gets the output back.
Custom APIs, hooks, event listeners, schedulers, migrations and test cases run in Docker containers. The worker sends the code and the request over TCP and gets the output back.
When your code calls g.sys.db.query, the call goes back to the worker, which runs the real API with its checks, and returns the rows to the sandbox.
13 seconds by default. Change it per request with the x-am-sandbox-timeout header, or in the settings of a custom API, a scheduler or a listener.
It gets no new requests, the ones inside it finish, then it is removed and a new sandbox takes its place. The time to get a sandbox is not counted in the logs.
Each admin user gets a sandbox image built from a Dockerfile and the npm packages you add. Restart all sandboxes and they start from the new image.
Sandboxes per worker, a restart every N seconds, a separate sandbox for a heavy API, or the native process for code you trust.
An endless loop, a crash or a memory leak in your code stays in its container. API Maker keeps serving the other requests.
Every run has a time limit, per request or per API. Each sandbox has a heap limit: sandboxMaxOldSpaceMB, or the larger of 2500 MB and the memory of the server divided by its CPU count.
A sandbox that times out gets no new requests, the ones inside it finish, and a new one takes its place. You can also restart sandboxes every N seconds.
Add npm packages in the sandbox settings, edit the Dockerfile, and the image of your account is built with them.
Give a heavy custom API a sandbox group of its own, with its own packages, Dockerfile and restart interval.
Turn on debugging and attach Chrome DevTools to the sandbox: breakpoints, steps and variables in your TypeScript.
Generating PDFs needs a big package and a lot of memory. In its own sandbox group, it gets its package and restarts every hour, while every other API keeps its small, fast sandboxes.
import * as T from 'types';let customApi: T.ICustomApiSettingsTypes = { name: 'Invoice PDF', requestMethod: T.ERequestMethod.POST, path: '/invoice-pdf', customApiTimeoutInSeconds: 60, separateSandboxSettings: { enableSeparateSandboxForThis: 'pdf_group', packages: { allowAllPackagesOfAdmin: false, sandboxPackages: [{ name: 'pdfkit', version: '0.15.0' }] }, autoRestart: { afterTheseMuchSeconds: 3600 }, }, errorList: [],};module.exports = customApi;Each API Maker process keeps a pool per account, sandboxCountForAdmin containers, and a pool per sandbox group. Requests wait in a queue when all of them are busy.
Through g.sys.db. The call goes back to API Maker, which runs the real API with its checks and returns the rows.
Yes. Send x-am-sandbox-timeout in milliseconds, or set the limit in the settings of the custom API, scheduler or listener.