Optimize Cold Start Performance for WeChat Mini Program Cloud Functions
Four actionable techniques to reduce CloudBase Cloud Function cold start latency: move initialization out of the handler, trim dependencies, tune memory, and enable Per-instance Concurrency. Full code included.
Proxy Overseas LLM APIs (OpenAI / Anthropic) via Cloud Function
Build a thin reverse proxy in a CloudBase Web Cloud Function (HTTP trigger) to handle overseas LLM access, keep API keys out of the frontend, and pass through SSE streaming responses.
Pull Cloud Function Logs with manager-node and Alert Failures to WeCom
Run a monitoring Cloud Function on a cron schedule. Use @cloudbase/manager-node's getFunctionLogsV2 to pull Cloud Function logs from the past 5 minutes, treat RetCode 500 as errors, and send alerts to a WeCom Group Bot with threshold checks and deduplication.
Run Cron Jobs with CloudBase Cloud Function Timer Triggers
Configure a timer trigger in cloudbaserc.json to run daily reports, data cleanup, and cache warming. Covers the 7-field cron format, idempotency for duplicate-run prevention, and failure alerts via WeCom webhook.
Send WeChat Mini Program Subscribe Messages via Cloud Function
The Mini Program frontend obtains user authorization via wx.requestSubscribeMessage, the server uses cloud.openapi.subscribeMessage.send to deliver messages, covering differences between one-time and long-term subscriptions and handling of 43101/47003 errors.
Send WeCom Group Bot Messages with a CloudBase Cloud Function
Use a CloudBase Cloud Function to push text, Markdown, images, and other message types to a WeCom Group Bot via Webhook. Add a timer trigger for monitoring alerts.
WxCloudSDKError: [Error] secret id error
When locally debugging cloud functions in WeChat Developer Tools, you may encounter the error message WxCloudSDKError: [Error] secret id error. This error is usually caused by the local debugging environment failing to correctly verify secretId.