火箱错误的云功能:禁止



我试图通过我的应用程序上的 multipart/form-data发送 CC_1到firebase的云功能。为了测试我的云功能和应用程序是否已连接,我创建了一个测试功能并部署了:

function test(data, callback) {
    console.log("Test begin:");
    console.log(data);
    console.log("Test finish...");
    callback(null, null);
}
exports.test = functions.https.onRequest((request, respond) => {
    console.log("test called");
    test(request.body.data, function(data, error) {
        respond.json({
            data: data, 
            error: error
        });
    });
});

但是,在发送URLRequest后,在控制台上没有打印任何东西,而是我得到了HTML作为数据。通过打开HTML,我得到Error: Forbidden. Your client does not have permission to get URL / from this server.如何解决此问题?

感谢@Doug Stevenson,问题是我使用了错误的URL而不是提供的URL。并且在部署云功能时可以在控制台上找到URL。

云功能具有处理不同类型输入的特殊方法。它已记录在这里。

对于multipart/form-data,您可以访问内容为request.rawBody

最新更新