Vercel News
Vercel Sandbox creation now returns a ready sandbox
6.4内容质量
TL;DR · AI 摘要
Vercel Sandbox creation now returns a ready sandbox - Vercel A new Vercel Sandbox is now ready to run commands and read...
核心要点
- 主题聚焦:Vercel Sandbox creation now returns a ready sand
- 来源:Vercel News,建议结合原文判断细节。
- AI 分析暂不可用,本条为保底评分与摘要。
#AI#产品
打开原文Vercel Sandbox 创建现在会立即返回就绪的沙箱 - Vercel
现在创建新的 Vercel Sandbox 后,即可立即运行命令并读取或写入文件。
Sandbox.create() 现在仅在快照恢复完成后才会解析,因此第一个命令或文件操作不再需要等待。启动错误也会直接拒绝 Sandbox.create() 调用,而非在操作过程中显示错误。
code
1
import
{
Sandbox
}
from
'@vercel/sandbox'
;
2
3
// Resolves after snapshot restoration. Startup failures reject here.
4
const
sandbox
=
await
Sandbox
.
create
(
)
;
5
6
// Runs without waiting for snapshot restoration.
7
await
sandbox
.
runCommand
(
'node'
,
[
'--version'
]
)
;创建沙箱后立即运行命令。
快照恢复时间现在计入创建过程,而非首次操作的时间。创建耗时在 p50 指标下增加了约 50 毫秒,未缓存快照的场景可能有更显著的增加。但通过首次操作的总耗时保持不变。
此变更会自动应用,无需升级 SDK 或修改配置。详细信息请参阅 Sandbox.create() 文档。