简体   繁体   English

Firebase 使用 Easypost 函数部署失败“部署函数时出错”

[英]Firebase Functions deploy fails 'There was an error deploying Functions' with Easypost

Hello fellow world peace and Moonbase-36 residents, Deploying this firebase function Fails because I've added EASYPOST into the file.世界和平和 Moonbase-36 居民,您好,部署此 firebase function 失败,因为我已将 EASYPOST 添加到文件中。 Do I need to create another functions file and deploy that to make this work?我是否需要创建另一个函数文件并部署它才能完成这项工作?

// require('babel-polyfill');
const functions = require("firebase-functions");
const cors = require("cors");
const express = require("express");
const EasyPost = require('@easypost/api');
const EPapi = new EasyPost('YOURAPIKEY');

const app = express();
const stripe = require("stripe")("APIKEY");

As soon as I comment out the const EasyPost and const EPapi, the deploy works fine.只要我注释掉 const EasyPost 和 const EPapi,部署就可以正常工作。 But we need Easypost to work.但是我们需要 Easypost 才能工作。

firebase functions:log Detailed stack trace: Error: Cannot find module '@easypost/api' firebase 功能:日志详细堆栈跟踪:错误:找不到模块“@easypost/api”

OP resolved the issue by installing Easypost using npm install Easypost into the Functions folder to have it as dependency in firebase functions. OP 通过使用npm install Easypost到 Functions 文件夹中以将其作为 firebase 函数的依赖项来解决此问题。 The functions were deployed without errors.功能部署无误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM