Unable to deploy Edge Function
如果你在部署 Edge Function 时遇到问题,可以按照这些步骤来诊断和解决问题。
🌐 If you're having trouble deploying an Edge Function, follow these steps to diagnose and resolve the issue.
查出问题 #
🌐 Diagnose the issue
- 检查函数语法: 在本地对你的函数文件运行
deno check - 检查依赖: 确认所有导入的内容都可以访问并且与 Deno 兼容
- 检查包大小: 大函数可能无法部署
# Check for syntax errorsdeno check ./supabase/functions/your-function/index.ts# Deploy with verbose outputsupabase functions deploy your-function --debug常见原因 #
🌐 Common causes
- 语法错误: 你的函数代码里 TypeScript 或 JavaScript 的语法问题
- 无效的导入: 导入不存在或与 Deno 不兼容的模块
- 包体积较大: 当通过 CLI 本地打包时,函数的最大大小为 20MB;当通过服务器端打包(例如通过管理 API 或仪表板)时,最大大小为 5MB。更多详情请参见 包体积问题
- 网络问题: 部署过程中无法访问 Supabase API
在提交支持请求之前 #
🌐 Before opening a support ticket
确保你使用的是最新版本的 Supabase CLI:
🌐 Make sure you're using the latest version of the Supabase CLI:
supabase --version如果它过时了,就用安装 CLI 的那个包管理器升级,比如 brew upgrade supabase、npm update supabase --save-dev 或 scoop update supabase。
🌐 If it's out of date, upgrade using whichever package manager installed the CLI, for example brew upgrade supabase, npm update supabase --save-dev, or scoop update supabase.
如果这些步骤不能解决问题,请通过 Supabase 仪表板提交支持工单,并附上诊断命令的所有输出。
🌐 If these steps don't resolve the issue, open a support ticket via the Supabase Dashboard and include all output from the diagnostic commands.
额外资源 #
🌐 Additional resources