Firebase和第三方api的云功能 [英] Cloud Functions for Firebase and third party api

查看:180
本文介绍了Firebase和第三方api的云功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是与Firebase函数一起使用API​​,有问题的API是Coinbase,我将API与node一起使用,如果我在终端中使用node命令测试了它的工作原理,但是当我将其与Firebase函数根本无法使用,我已经尝试解决问题近一个星期了.

My problem is to make use of an API along with Firebase Functions, the API in question is Coinbase, I use the API with node, if I test in the terminal with the node command it works, however when I use it with Firebase Functions Does not work at all, I've been trying to solve the problem for almost a week now.

代码如下>

    var functions = require('firebase-functions');


    var Client = require('coinbase').Client;
    var client = new Client({
        "apiKey": "xxxxxxxxxxxx",
        "apiSecret": "xxxxxxxxxxxxxxxxxxxxxxx"
    });    


exports.helloWorld = functions.https.onRequest((request, response) => {



    this.client.getAccounts({}, function(err, accounts) {

        if(accounts){

            response.send(accounts);
         }else{
            response.send(err);

        }

    });
});

错误: https://us-central1-investimentos-b7406.cloudfunctions. net/helloWorld

Coinbase API: https://developers.coinbase.com/docs /wallet/guides/bitcoin-wallet

The Coinbase API: https://developers.coinbase.com/docs/wallet/guides/bitcoin-wallet

推荐答案

docs :

Spark计划中的Firebase项目只能向 Google API.对第三方API的请求失败,并显示错误.欲了解更多 有关升级项目的信息,请参见定价.

Firebase projects on the Spark plan can make only outbound requests to Google APIs. Requests to third-party APIs fail with an error. For more information about upgrading your project, see Pricing.

因此,您需要升级到付费计划才能使用外部API.

So you'll need to upgrade to a paid plan to use external APIs.

这篇关于Firebase和第三方api的云功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆