我的问题是使用API和Firebase函数,有问题的API是Coinbase,我使用带有节点的API,如果我在终端中用node命令测试它可以工作,但是当我使用它时Firebase功能根本不起作用,我已经尝试解决问题近一周了。
代码如下>
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