ipfs 模块不适用于 firebase 功能 [英] Ipfs module not working with firebase functions

查看:39
本文介绍了ipfs 模块不适用于 firebase 功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 firebase 云功能将数据存储在 IPFS 上.我能够安装 ipfs-mini 包.

I am trying to use firebase cloud functions to store data on IPFS. I was able to install ipfs-mini package.

const IPFS = require('ipfs-mini');
const ipfs = new IPFS({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' });

ipfs.add("testdata")
    .then(function(result){               
      response.send(result);
    })  
    .catch(function (err) {            
      response.send(err)
    })

但是我得到了截图中的错误

However I get error as in screenshot

推荐答案

根据您的错误 getaddrinfo ENOTFOUND ...,可能是因为您使用的是免费的Spark"计划.您需要使用Flame"或Blaze"定价计划.

Based on your error getaddrinfo ENOTFOUND ..., it is probably because you are on the free "Spark" plan. You need to be on the "Flame" or "Blaze" pricing plan.

事实上,免费的Spark"计划只允许向 Google 拥有的服务发出出站网络请求".请参阅 https://firebase.google.com/pricing/(将鼠标悬停在问号上位于云功能"标题之后)

As a matter of fact, the free "Spark" plan "allows outbound network requests only to Google-owned services". See https://firebase.google.com/pricing/ (hover your mouse on the question mark located after the "Cloud Functions" title)

由于 IPFS 不是 Google 拥有的服务,因此您需要切换到Flame"或Blaze"计划.

Since IPFS is not a Google-owned service, you need to switch to the "Flame" or "Blaze" plan.

请注意,如果您选择Blaze"计划,您仍然可以利用免费Spark"计划提供的免费套餐(请参阅顶部的包含 Spark 计划的免费使用"备注-定价表的右侧单元格)

Note that if you take the "Blaze" plan, you will still be able to take advantage of the free tier offered by the free "Spark" plan (See the "Free usage from Spark plan included" remark in the top-right cell of the pricing table)

这篇关于ipfs 模块不适用于 firebase 功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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