使用Twilio Firebase扩展发送短信时回调URL无效(11200错误)
解决Firebase Twilio扩展发送短信时的11200错误(回调URL 404)
你遇到的11200错误是因为Twilio无法访问扩展自动生成的状态回调URL,返回了404。以下是具体解决步骤:
重新部署Twilio扩展
自动生成的回调URL对应的Cloud Function可能部署不完整或失败。打开终端,进入你的Firebase项目目录,执行以下命令重新部署扩展:firebase ext:update twilio/sms如果更新无效,可先卸载再重新安装:
firebase ext:uninstall twilio/sms firebase ext:install twilio/sms注意观察部署日志,确保没有权限或依赖报错。
检查Cloud Functions状态
登录Firebase控制台,进入「函数」面板,找到Twilio扩展创建的状态回调函数(命名通常为ext-twilio-sms-statusCallback):- 确认函数状态为「已部署」
- 如果函数部署失败,点击「查看日志」定位具体问题(比如Node.js版本不兼容、权限配置错误)
验证回调URL可用性
扩展生成的回调URL格式为https://<区域>-<项目ID>.cloudfunctions.net/ext-twilio-sms-statusCallback。手动在浏览器访问该URL,正常情况下会返回405 Method Not Allowed(因为接口仅接受POST请求),但不会出现404。如果仍返回404,说明函数未正确部署,需重新执行第一步。确认Firebase项目付费计划
免费的Spark计划禁止外部服务(如Twilio)调用Cloud Functions,会直接返回404。需将项目升级到Blaze按需付费计划,确保外部请求可以访问你的Cloud Functions。同步Twilio端Webhook配置
偶尔扩展和Twilio控制台的配置会不同步:- 登录Twilio控制台,进入「Phone Numbers」→「Manage」→「Active Numbers」
- 选择你用于发送短信的号码,进入「Messaging」标签
- 检查「Status Callback」是否和Firebase扩展生成的URL一致,不一致则手动替换
错误详情参考:
Error Details Msg=Request+to+StatusCallback+URL+was+not+successful.&httpResponse=404<html><head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>404 Page not found</title> </head> <body text=#000000 bgcolor=#ffffff> <h1>Error: Page not found</h1> <h2>The requested URL was not found on this server.</h2> <h2></h2> </body></html>
内容的提问来源于stack exchange,提问作者Greg Fielding
相关产品推荐
相关产品推荐

