无服务器函数
如果你的应用是通过 "无服务器函数" 或 "函数即服务 (FaaS)" 产品部署并使用标准 Node.js 运行时,则它是无服务器应用。常见的部署示例包括 AWS Lambda 和 Vercel 无服务器函数。
¥If your application is deployed via a "Serverless Function" or "Function-as-a-Service (FaaS)" offering and uses a standard Node.js runtime, it is a serverless app. Common deployment examples include AWS Lambda and Vercel Serverless Functions.
如果 Prisma ORM 的 Rust 引擎二进制文件导致包体积过大、构建速度缓慢或部署问题(例如,在无服务器或边缘环境中),你可以使用 generator
块的以下配置来使用它,而无需使用它们:
¥If Prisma ORM's Rust engine binaries cause large bundle sizes, slow builds, or deployment issues (for example, in serverless or edge environments), you can use it without them using this configuration of your generator
block:
generator client {
provider = "prisma-client-js" // or "prisma-client"
engineType = "client"
}
自 v6.16.0 以来,不带 Rust 二进制文件的 Prisma ORM 一直是 一般可用。
¥Prisma ORM without Rust binaries has been Generally Available since v6.16.0.
请注意,在这种情况下,你需要使用 驱动适配器。
¥Note that you need to use a driver adapter in this case.
使用此架构时:
¥When using 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 simplify deployments in:
-
无服务器函数
¥Serverless functions
-
Edge 运行时
¥Edge runtimes
-
只读文件系统环境
¥Read-only filesystem environments
-
具有严格大小限制的 CI/CD 流水线
¥CI/CD pipelines with strict size limits
此设置可以简化无服务器或边缘运行时中的部署。在 文档在这里 中了解更多信息。
¥This setup can simplify deployments in serverless or edge runtimes. Learn more in the docs here.
好奇我们为什么放弃 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.
无服务器函数提供商指南
¥Guides for Serverless Function providers
部署到 Azure Functions
本指南介绍了使用 Azure 函数 将基于 Node.js 的函数应用部署到 Azure 时如何避免常见问题。
部署到 Vercel
本指南将引导你完成设置和部署使用 Prisma 到 Vercel 的无服务器应用的步骤。
部署到 AWS Lambda
本指南介绍了使用 Prisma ORM 将项目部署到 AWS Lambda 时如何避免常见问题。
部署到 Netlify
本指南涵盖了将使用 Prisma ORM 的应用部署到 Netlify 所需执行的步骤。