Serverless deployment
Deployment option | Rating | Description |
|---|---|---|
| Tencent CloudBase | ★★★☆☆ | Deploy to a Tencent CloudBase environment from the console. Fast inside mainland China. A paid plan (Personal or above) is required: the free trial plan cannot add a cross-origin domain under HTTP 网关 → 跨域设置 (paid plans only), and its cloud function timeout is fixed at 3 seconds. |
| Vercel | ★★★☆☆ | Good free tier. Slower or unreachable from mainland China; bind your own domain to improve speed. |
| Netlify | ★★★★☆ | Generous free tier and decent speed from mainland China. |
| AWS Lambda | ★★★☆☆ | Best fit if you already use AWS. |
| EdgeOne Makers | ★★☆☆☆ | Tencent Cloud EdgeOne. Restricted capabilities: email via limited channels only; no spam filtering or AI features. See the adapter README for details. |
| Self-hosted (Node / Docker) | ★★★☆☆ | For users with their own server; you need your own HTTPS certificate. |
Step-by-step walkthroughs with screenshots are maintained in the Chinese documentation: 云函数部署.
Tencent CloudBase
Prerequisite: a paid plan (Personal or above)
The free trial plan cannot use HTTP 网关 → 跨域设置 → 添加跨域域名 (the console shows 您当前版本暂不支持此功能), so step 2 below cannot be completed — without your site domain in the CORS allowlist the comment box cannot call the cloud function.
自定义域名 is a paid-plan entitlement (official pricing doc: 1 for Personal, 5 for Standard, 50 for Enterprise), so upgrading to Personal (¥19.9/mo) is enough.
Also, on the free trial plan the function timeout is fixed at 3 seconds and the memory at 256MB, neither changeable (Personal and above allow up to 900 seconds and adjustable memory). The adapter now loads jsdom / DOMPurify during instance initialisation (see packages/server-cloudbase/src/prewarm.ts), so submitting a comment on a cold instance measured about 1.1s and does fit inside 3 seconds — but the margin is thin (worst observed 1.9s); on a paid plan raise the timeout to 30s or more and there is plenty of room.
- Create a CloudBase environment and enable anonymous sign-in (身份认证 → 配置 → 登录方式 → 允许匿名登入).
- Add your site domain under HTTP 网关 → 跨域设置 → 添加跨域域名 (paid plans only — cannot be done on the free plan, see the prerequisite above).
- In 云函数 → 函数管理,open the
⋮menu to the right of鉴权设置and choose权限控制(legacy), then replace the rule with:
{
"*": {
"invoke": "auth != null"
}
}- Still in 云函数 → 函数管理,create a function from the Node.js Hello World template.
Keep the runtime at the template default, Node.js 20.19. Two runtimes must be avoided: Node.js 24.11(公测中) — measured to fail online dependency installation, leaving the function in a broken state (
[ResourceNotFound.Package] BuildCodeViaSCF Failed resp:null: Dependency error, no code deployed); and Node.js 18.15 — too old for dependencies such ashtml-to-text(requires ≥ 20.19).
- Replace
index.jswith:
exports.main = require("twikoo-func").main;- Replace
package.jsonwith the following, then let the console install dependencies online (在线装依赖):
{ "dependencies": { "twikoo-func": "latest" } }latest always points at the newest stable release, so upgrading is just hitting 保存并安装依赖 again — no version number to remember. Pin an explicit version instead if you prefer, at the cost of editing it on every upgrade.
- Leave the other files unchanged. Name the function
twikoo, expand配置信息and set运行环境to Node.js 24.11(公测中), then click create. TheenvIdis shown as<environment name>-<random suffix>— without thehttps://prefix.