【问题标题】:Cloud Functions for Firebase HelloWorld "Error: An unexpected error has occurred."Cloud Functions for Firebase HelloWorld“错误:发生意外错误。”
【发布时间】:2017-08-23 09:43:54
【问题描述】:

当尝试运行firebase youtube video 上的简单 HelloWorld 示例时。

我更加困惑,因为它没有提供详细的错误消息,并且使用命令 firebase functions:log 找到的日志文件是空的。

我也使用 Webstorm 作为我的 IDE

这是终端截图

index.js 文件

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

// Create and Deploy Your First Cloud Functions
// https://firebase.google.com/docs/functions/write-firebase-functions

exports.helloWorld = functions.https.onRequest((request, response) => {
 response.send("Hello from Firebase!");
});

package.json

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "dependencies": {
    "firebase-admin": "~4.2.1",
    "firebase-functions": "^0.5.7"
  },
  "private": true
}

【问题讨论】:

  • 部署失败,所以服务器上不会记录任何内容。检查firebase-debug.log 文件,看看它是否包含任何有用的信息。
  • @FrankvanPuffelen 检查根目录和函数文件夹中没有 firebase-debug.log 文件。
  • 尝试运行firebase deploy --debug
  • thats 命令产生了一条错误消息,我能够解决问题

标签: javascript node.js firebase google-cloud-functions


【解决方案1】:

您可能正在使用带有版本8.0.0Node。 降级就好了。

我已经尝试使用6.10.3 并获得了成功:)

【讨论】:

  • 问题实际上是相反的,我运行的是旧版本的节点。我不得不升级
  • 所以你使用的节点版本低于v6.10.3 :)
猜你喜欢
  • 2020-06-18
  • 2018-08-21
  • 2017-08-19
  • 1970-01-01
  • 2018-06-11
  • 2019-09-11
  • 1970-01-01
  • 2018-11-21
  • 2023-03-04
相关资源
最近更新 更多