Accessors
sandboxId
Get Signature
Returns
string
status
Get Signature
Returns
"pending"
| "running"
| "stopping"
| "stopped"
| "failed"
Methods
list()
Parameters
Parameter | Type |
---|---|
params | { projectId : string ; limit? : number ; since? : number | Date ; until? : number | Date ; } & Partial <Credentials > |
Returns
Promise
<Parsed
<{
sandboxes
: {
id
: string
;
memory
: number
;
vcpus
: number
;
region
: string
;
runtime
: string
;
timeout
: number
;
status
: "pending"
| "running"
| "stopping"
| "stopped"
| "failed"
;
requestedAt
: number
;
startedAt?
: number
;
requestedStopAt?
: number
;
stoppedAt?
: number
;
duration?
: number
;
createdAt
: number
;
cwd
: string
;
updatedAt
: number
;
}[];
pagination
: {
count
: number
;
next
: null
| number
;
prev
: null
| number
;
};
}>>
create()
Parameters
Parameter | Type | Description |
---|---|---|
params? | WithPrivate < | { source? : | { type : "git" ; url : string ; depth? : number ; revision? : string ; } | { type : "git" ; url : string ; username : string ; password : string ; depth? : number ; revision? : string ; } | { type : "tarball" ; url : string ; }; ports? : number []; timeout? : number ; resources? : { vcpus : number ; }; runtime? : | string & { } | "node22" | "python3.13" ; } | { source? : | { type : "git" ; url : string ; depth? : number ; revision? : string ; } | { type : "git" ; url : string ; username : string ; password : string ; depth? : number ; revision? : string ; } | { type : "tarball" ; url : string ; }; ports? : number []; timeout? : number ; resources? : { vcpus : number ; }; runtime? : | string & { } | "node22" | "python3.13" ; } & Credentials > | Creation parameters and optional credentials. |
Returns
Promise
<Sandbox
>
A promise resolving to the created Sandbox.
get()
Parameters
Parameter | Type | Description |
---|---|---|
params | | { sandboxId : string ; } | { sandboxId : string ; } & Credentials | Get parameters and optional credentials. |
Returns
Promise
<Sandbox
>
A promise resolving to the Sandbox.
getCommand()
Parameters
Parameter | Type | Description |
---|---|---|
cmdId | string | ID of the command to retrieve |
Returns
Promise
<Command
>
A Command instance representing the command
runCommand()
Call Signature
Parameters
Parameter | Type | Description |
---|---|---|
command | string | The command to execute. |
args? | string [] | Arguments to pass to the command. |
Returns
Promise
<CommandFinished
>
A CommandFinished result once execution is done.
Call Signature
Parameters
Parameter | Type | Description |
---|---|---|
params | { cmd : string ; args? : string []; cwd? : string ; env? : Record <string , string >; sudo? : boolean ; detached? : boolean ; stdout? : Writable ; stderr? : Writable ; } & { detached : true ; } | The command parameters. |
Returns
Promise
<Command
>
A Command instance for the running command.
Call Signature
Parameters
Parameter | Type | Description |
---|---|---|
params | { cmd : string ; args? : string []; cwd? : string ; env? : Record <string , string >; sudo? : boolean ; detached? : boolean ; stdout? : Writable ; stderr? : Writable ; } | The command parameters. |
params.cmd | string | The command to execute |
params.args? | string [] | Arguments to pass to the command |
params.cwd? | string | Working directory to execute the command in |
params.env? | Record <string , string > | Environment variables to set for this command |
params.sudo? | boolean | If true, execute this command with root privileges. Defaults to false. |
params.detached? | boolean | If true, the command will return without waiting for exitCode |
params.stdout? | Writable | A Writable stream where stdout from the command will be piped |
params.stderr? | Writable | A Writable stream where stderr from the command will be piped |
Returns
Promise
<CommandFinished
>
A CommandFinished result once execution is done.
_runCommand()
Internal
Internal helper to start a command in the sandbox.
Parameters
Parameter | Type | Description |
---|---|---|
params | { cmd : string ; args? : string []; cwd? : string ; env? : Record <string , string >; sudo? : boolean ; detached? : boolean ; stdout? : Writable ; stderr? : Writable ; } | Command execution parameters. |
params.cmd | string | The command to execute |
params.args? | string [] | Arguments to pass to the command |
params.cwd? | string | Working directory to execute the command in |
params.env? | Record <string , string > | Environment variables to set for this command |
params.sudo? | boolean | If true, execute this command with root privileges. Defaults to false. |
params.detached? | boolean | If true, the command will return without waiting for exitCode |
params.stdout? | Writable | A Writable stream where stdout from the command will be piped |
params.stderr? | Writable | A Writable stream where stderr from the command will be piped |
Returns
Promise
<Command
| CommandFinished
>
A Command or CommandFinished, depending on detached
.
mkDir()
Parameters
Parameter | Type | Description |
---|---|---|
path | string | Path of the directory to create |
Returns
Promise
<void
>
readFile()
Parameters
Parameter | Type | Description |
---|---|---|
file | { path : string ; cwd? : string ; } | File to read, with path and optional cwd |
file.path | string | - |
file.cwd? | string | - |
Returns
Promise
<null
| ReadableStream
>
A promise that resolves to a ReadableStream containing the file contents
writeFiles()
vercel-sandbox
user.
Parameters
Parameter | Type | Description |
---|---|---|
files | { path : string ; content : Buffer ; }[] | Array of files with path and stream/buffer contents |
Returns
Promise
<void
>
A promise that resolves when the files are written
domain()
Parameters
Parameter | Type | Description |
---|---|---|
p | number | Port number to resolve |
Returns
string
A full domain (e.g. https://subdomain.vercel.run
)
Throws
If the port has no associated routestop()
Returns
Promise
<void
>
A promise that resolves when the sandbox is stopped