Skip to main content

排查二进制文件大小和部署问题

如果你遇到与 Prisma Rust 引擎二进制文件相关的软件包过大、构建速度缓慢或部署错误(例如在无服务器或边缘环境中),则问题可能是由 Prisma 客户端附带的默认原生 Rust 查询引擎引起的。

¥If you encounter large bundle sizes, slow builds, or deployment errors related to Prisma’s Rust engine binaries, for example, in serverless or edge environments, the issue may be caused by the default native Rust query engine that ships with Prisma Client.

v6.16.0 起,你可以通过从 Prisma ORM 中删除基于 Rust 的引擎二进制文件来解决这些问题,具体方法如下:

¥As of v6.16.0, you can resolve these issues by removing the Rust-based engine binary from Prisma ORM by configuring your generator block as follows:

generator client {
provider = "prisma-client-js"
engineType = "client"
}
注意

请注意,在这种情况下,你需要使用 驱动适配器

¥Note that you need to use a driver adapter in this case.

在此架构下:

¥With this architecture:

  • 无需下载或安装 Rust 查询引擎二进制文件。

    ¥No Rust query engine binary is downloaded or shipped.

  • 数据库连接池由你安装的原生 JS 数据库驱动程序(例如,PostgreSQL 的 @prisma/adapter-pg)维护。

    ¥The database connection pool is maintained by the native JS database driver you install (e.g., @prisma/adapter-pg for PostgreSQL).

如果你符合以下情况,此设置将有所帮助:

¥This setup can help if you are:

  • 部署到无服务器函数或边缘运行时

    ¥Deploying to serverless functions or edge runtimes

  • 在只读文件系统环境中运行

    ¥Running in read-only filesystem environments

  • 在具有严格大小限制的 CI/CD 流水线中工作

    ¥Working within CI/CD pipelines with strict size limits

访问 此页面 获取完整的设置说明和支持的数据库。

¥Visit this page for complete setup instructions and supported databases.

好奇我们为什么放弃 Rust 引擎?了解为什么我们在 博客文章 中从 Rust 二进制引擎过渡到全 TypeScript 方法,以实现更快、更轻量的 Prisma ORM。

¥Curious why we moved away from the Rust engine? Take a look at why we transitioned from Rust binary engines to an all-TypeScript approach for a faster, lighter Prisma ORM in this blog post.