Run Code in VM
run_code_in_vmRun a Node.js snippet on the project's compute VM and return its stdout and stderr. ESM by default (a bare require() snippet runs as CJS). The project's npm dependencies are importable and the network works, so a snippet can call the project's /_api/* endpoints (get_preview_url → apiBaseUrl). It runs in an isolated directory: the project's env vars, secrets and source files are not available.
A _floot global gives helpers that run in the project's server context, limited to this project:
runSQLQuery({ query, resourceName?, reasonAndExplanationForNotReadOnly? }): read-only by default; with a reason, additive writes (INSERT, CREATE TABLE). Other statements are refused: use execute_sql for those, and query_database for one-off reads.Usage and logs:
getHostingUsage,getLambdaUsage,getPushHistory,getProdBackendLogs(guides: hosting-cost-analysis, push-notification-history, prod-backend-logs).Storage:
storageList,storageGetUrl,storageGetFileSizes,storageUpload,storageDelete,getFileById(guide: static-storage).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| projectId | Yes | ||
| timeout_seconds | No |