我有一个主要的firebase云端功能主要功能。但我需要创建另一个更具体的使用主要云功能的功能。我可以通过一个免费帐户申请一个http Post或者从一个Firebase云端功能获取另一个Firebase云端功能吗?Firebase云端功能http请求到另一个Firebase云端功能
我试图做到这一点,但我得到'ENOTFOUND'消息,我想知道如果我的代码有问题或者它只是免费帐户的限制。
index.js'use strict';
const functions = require('firebase-functions');
const express = require('express');
const app = express();
app.post('/test', function(req, res) {
var request = require('request')
var options = {
method: 'post',
body: req.body, // re-send the incoming body to the main cloud function
json: true,
url: '<main cloud url>',
headers: req.headers // re-send the incoming headers the main cloud function
}
request(options, function (err, response, body) {
if (err || response.statusCode != 200) {
res.status(400).send(err); //re-send the received error to the client
return
}
res.send(body); //re-send the received response to the client
});
});
exports.checkAtivation = functions.https.onRequest(app);
你能分享一下你的代码吗? –
编辑将代码 –