Firebase-tools: 设置:网络 INVALID_ARGUMENT 状态代码 400

创建于 2018-11-15  ·  41评论  ·  资料来源: firebase/firebase-tools

版本信息:6.1.0
平台信息:OSX

重现步骤

光盘目录
firebase init(仅限托管)
选择现有项目
firebase serve --only 托管 --debug

它在本地运行站点。

[2018-11-15T17:12:15.331Z] <<< HTTP RESPONSE 400变化=X-Origin,Referer,Origin,Accept-Encoding,content-type=application/json; 字符集=UTF-8,日期=星期四,2018 年 11 月 15 日 17:12:15 GMT,服务器=ESF,缓存控制=私有,x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
[2018-11-15T17:12:15.331Z] <<< HTTP RESPONSE BODY code=400, message=Request contains an invalid argument., status=INVALID_ARGUMENT

错误:HTTP 错误:400,请求包含无效参数。
[2018-11-15T17:12:15.532Z] 错误上下文:{
“身体”: {
“错误”: {
“代码”:400,
"message": "请求包含无效参数。",
“状态”:“INVALID_ARGUMENT”
}
},
“回复”: {
“状态代码”:400,
“身体”: {
“错误”: {
“代码”:400,
"message": "请求包含无效参数。",
“状态”:“INVALID_ARGUMENT”
}
},
“标题”:{
"vary": "X-Origin, Referer, Origin, Accept-Encoding",
"content-type": "application/json; charset=UTF-8",
"date": "星期四,2018 年 11 月 15 日 17:12:15 GMT",
"服务器": "ESF",
“缓存控制”:“私有”,
"x-xss-protection": "1; mode=block",
"x-frame-options": "SAMEORIGIN",
"x-content-type-options": "nosniff",
"alt-svc": "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"",
“接受范围”:“无”,
“连接”:“关闭”
},
“要求”: {
“uri”:{
"协议": "https:",
“斜线”:真的,
“身份验证”:空,
"host": "mobilesdk-pa.googleapis.com",
“端口”:443,
"hostname": "mobilesdk-pa.googleapis.com",
“哈希”:空,
“搜索”:空,
“查询”:空,
"路径名": "/v1/projects/540833485883/clients/_:getWebAppConfig",
"path": "/v1/projects/540833485883/clients/_:getWebAppConfig",
"href": " https://mobilesdk-pa.googleapis.com/v1/projects/540833485883/clients/_ :getWebAppConfig"
},
“方法”:“获取”
}
}
}

最有用的评论

感谢大家提请我们注意此事。 我们现在正在积极调查这个问题。

(内部跟踪号:119615185)

所有41条评论

同样在这里:

版本信息:6.1.0(也用 6.0.0、5.0.0 测试过)
平台信息:OSX 10.14 macOS Mojave 18A391

$ firebase serve --only hosting,functions --debug

使用现有项目和新项目进行测试。 同样的错误。

Error: HTTP Error: 400, Request contains an invalid argument.
[2018-11-15T17:40:46.943Z] Error Context: {
  "body": {
    "error": {
      "code": 400,
      "message": "Request contains an invalid argument.",
      "status": "INVALID_ARGUMENT"
    }
  },
  "response": {
    "statusCode": 400,
    "body": {
      "error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "status": "INVALID_ARGUMENT"
      }
    },
    "headers": {
      "vary": "X-Origin, Referer, Origin,Accept-Encoding",
      "content-type": "application/json; charset=UTF-8",
      "date": "Thu, 15 Nov 2018 17:40:46 GMT",
      "server": "ESF",
      "cache-control": "private",
      "x-xss-protection": "1; mode=block",
      "x-frame-options": "SAMEORIGIN",
      "x-content-type-options": "nosniff",
      "alt-svc": "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"",
      "accept-ranges": "none",
      "connection": "close"
    },
    "request": {
      "uri": {
        "protocol": "https:",
        "slashes": true,
        "auth": null,
        "host": "mobilesdk-pa.googleapis.com",
        "port": 443,
        "hostname": "mobilesdk-pa.googleapis.com",
        "hash": null,
        "search": null,
        "query": null,
        "pathname": "/v1/projects/128559963708/clients/_:getWebAppConfig",
        "path": "/v1/projects/128559963708/clients/_:getWebAppConfig",
        "href": "https://mobilesdk-pa.googleapis.com/v1/projects/128559963708/clients/_:getWebAppConfig"
      },
      "method": "GET"
    }
  }
}

我遇到了完全相同的问题。 我只是在另一台机器上测试了同一个项目,没有任何更改,甚至另一个运行良好约3个月的项目,问题是一样的。 部署它的正常,但本地主机(_firebase serve --only functions,hosting --debug_)只是停止处理这个anoing错误......
我认为问题不在于应用程序(我的或你的)。
大约 2 小时前一切正常!

+1 给我

同样的问题。 昨天一切正常

[2018-11-15T17:22:20.885Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/xxx/clients/_:getWebAppConfig

[2018-11-15T17:22:21.179Z] <<< HTTP RESPONSE BODY code=400, message=Request contains an invalid argument., status=INVALID_ARGUMENT

+1 对我和一个朋友来说,昨天早上工作正常时,今天早上就停止工作了。 我在https://status.firebase.google.com上没有看到任何有关它的信息,Firebase 中是否有人可以发表评论?

+1 对我来说 - 一切都突然停止工作。 尝试从 6.0.1 升级到 6.1.0,现在firebase serve也给了我这条消息:

 functions: Preparing to emulate functions.
⚠  Setup required, please run: firebase setup:emulators:firestore

我成功运行该命令,当我再次尝试运行firebase serve时,我得到:

i  functions: Preparing to emulate functions.
✔  firestore: started on http://localhost:8080
⚠  firestore: Error: Invalid or corrupt jarfile /home/alex/.cache/firebase/emulators/cloud-firestore-emulator-v1.2.1.jar

查找我刚刚运行的命令,我找到了这个页面: https :

我尝试运行firebase --open-sesame emulators认为这是 6.1.0 的问题并收到此错误:

Error: Did not recognize preview feature

+1 同样的问题,今天早上开始

+1。 可以验证在现有项目中使用没有参数的firebase serve时出现的问题,使用firebase-tools版本 v6.0.1 和 v6.1.0。 此外, firebase serve命令在没有正确关闭打开服务端口的节点进程的情况下退出,需要手动终止该进程。

只是想补充一点,我也有这个问题。 firebase serve 昨天工作得很好。 这是在 firebase 6.0.1 和 6.1.0 上

我有完全相同的问题。

相同的!

相同的。 我现在无法部署

我也是:

image

感谢大家提请我们注意此事。 我们现在正在积极调查这个问题。

(内部跟踪号:119615185)

@Neilpoulin你不能部署? 您使用的是什么版本的 CLI,您遇到了什么错误?

抱歉 - 它与 fire base deploy 命令没有直接关系。 我的构建
过程包括一个获取这些配置的步骤,因为它失败了我
无法部署。
2018 年 11 月 15 日星期四下午 12:10 Michael Bleigh通知@github.com
写道:

@Neilpoulin https://github.com/Neilpoulin你不能部署? 什么
您使用的是 CLI 的版本,您遇到了什么错误?


你收到这个是因为你被提到了。

直接回复本邮件,在GitHub上查看
https://github.com/firebase/firebase-tools/issues/1015#issuecomment-439155616
或静音线程
https://github.com/notifications/unsubscribe-auth/AAw-atNnP6wSmeHQke6z4EKIsx1D6r7Yks5uvbw_gaJpZM4Ygu-y
.

如果这对某人有帮助,您可以通过在此期间强制端口来运行您的功能。 这将无助于部署或托管。 例子:
sudo firebase serve --only 功能 --port=9000

同样的问题……我们的开发因为这个问题而停止。 我们有一个 Angular 应用程序,其中包含为内容提供服务的 Firebase 函数。 我想这与 firebase 服务有关,但他们的状态仪表板显示为全绿色。 直到昨天一切正常。

它现在正在工作,但有警告......

⚠  database: WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/Users/rodrigodutra/.cache/firebase/emulators/firebase-database-emulator-v3.5.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
⚠  database:
...

我不再收到非法参数 400 错误,而是另一个错误,但现在仍然没有运行:

2018-11-15T20:01:14.098Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 15 Nov 2018 20:01:22 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
[2018-11-15T20:01:14.098Z] Starting @google-cloud/functions-emulator
[2018-11-15T20:01:14.115Z] Parsing function triggers
Warning: You're using Node.js v10.13.0 but Google Cloud Functions only supports v6.11.5.
[2018-11-15T20:01:14.238Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 15 Nov 2018 20:01:22 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
i  hosting: Serving hosting files from: public
✔  hosting: Local server: http://localhost:5000
⚠  database: WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/home/qkay/.cache/firebase/emulators/firebase-database-emulator-v3.5.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
⚠  database: 

error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
    at Server.setupListenHandle [as _listen2] (net.js:1286:14)
    at listenInCluster (net.js:1334:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1460:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:62:10)
error: supervisorPort (5001) is already in use
error: restPort (5002) is already in use
12:01:15.254 [NamespaceSystem-akka.actor.default-dispatcher-3] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started

12:01:15.408 [main] INFO com.firebase.server.forge.App$ - Listening on port 9000

12:01:15.438 [main] ERROR com.firebase.server.forge.App$ - Error initializing Netty Listener
java.net.BindException: Address already in use
    at java.base/sun.nio.ch.Net.bind0(Native Method)
    at java.base/sun.nio.ch.Net.bind(Net.java:461)
    at java.base/sun.nio.ch.Net.bind(Net.java:453)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
    at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128)
    at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:500)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1226)
    at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:495)
    at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:480)
    at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
    at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:209)
    at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:355)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:399)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:464)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
    at java.base/java.lang.Thread.run(Thread.java:834)

12:01:15.440 [Thread-1] INFO com.firebase.server.forge.App$ - Attempting graceful shutdown.

12:01:15.444 [NamespaceSystem-akka.actor.default-dispatcher-4] INFO akka.actor.CoordinatedShutdown - Starting coordinated shutdown from JVM shutdown hook

12:01:15.448 [Thread-1] INFO com.firebase.server.forge.App$ - Graceful shutdown complete.


Error: database: emulator has exited with code: 1

我不再收到非法参数 400 错误,而是另一个错误,但现在仍然没有运行:

2018-11-15T20:01:14.098Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 15 Nov 2018 20:01:22 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
[2018-11-15T20:01:14.098Z] Starting @google-cloud/functions-emulator
[2018-11-15T20:01:14.115Z] Parsing function triggers
Warning: You're using Node.js v10.13.0 but Google Cloud Functions only supports v6.11.5.
[2018-11-15T20:01:14.238Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 15 Nov 2018 20:01:22 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="44,43,39,35", accept-ranges=none, connection=close
i  hosting: Serving hosting files from: public
✔  hosting: Local server: http://localhost:5000
⚠  database: WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/home/qkay/.cache/firebase/emulators/firebase-database-emulator-v3.5.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
⚠  database: 

error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
    at Server.setupListenHandle [as _listen2] (net.js:1286:14)
    at listenInCluster (net.js:1334:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1460:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:62:10)
error: supervisorPort (5001) is already in use
error: restPort (5002) is already in use
12:01:15.254 [NamespaceSystem-akka.actor.default-dispatcher-3] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started

12:01:15.408 [main] INFO com.firebase.server.forge.App$ - Listening on port 9000

12:01:15.438 [main] ERROR com.firebase.server.forge.App$ - Error initializing Netty Listener
java.net.BindException: Address already in use
  at java.base/sun.nio.ch.Net.bind0(Native Method)
  at java.base/sun.nio.ch.Net.bind(Net.java:461)
  at java.base/sun.nio.ch.Net.bind(Net.java:453)
  at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
  at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:128)
  at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:500)
  at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1226)
  at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:495)
  at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:480)
  at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
  at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:209)
  at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:355)
  at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:399)
  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:464)
  at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
  at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
  at java.base/java.lang.Thread.run(Thread.java:834)

12:01:15.440 [Thread-1] INFO com.firebase.server.forge.App$ - Attempting graceful shutdown.

12:01:15.444 [NamespaceSystem-akka.actor.default-dispatcher-4] INFO akka.actor.CoordinatedShutdown - Starting coordinated shutdown from JVM shutdown hook

12:01:15.448 [Thread-1] INFO com.firebase.server.forge.App$ - Graceful shutdown complete.


Error: database: emulator has exited with code: 1

重新启动您的 Mac...

尝试firebase serve --only hostingfirebase serve --only functions来解决这个问题。 现在正在寻找解决方案。

我也有这个问题; 刚刚重新启动了我的电脑,它又可以工作了。

@Neilpoulin你不能部署? 您使用的是什么版本的 CLI,您遇到了什么错误?

@mbleigh现在我回到了我的

具体来说,我在 node.js 中运行firebase-tools 。 失败的命令是这样的:

当我第一次遇到这个错误时, firbase-tools的版本是6.0.1 。 然后我将它升级到6.1.0但错误是一样的。

const fbcli = require("firebase-tools");
const opts = {"project": "stage"}; //this is an active alias for my firebase setup
return fbcli.setup
    .web(opts)
    .then(firebaseConfig => { 
        // some config setup stuff for webpack
    }.catch(error => {
        //This gets called rigt away, see error object below
        console.error(error);
    })

捕获的错误如下所示:

{
  "name": "FirebaseError",
  "message": "HTTP Error: 400, Request contains an invalid argument.",
  "children": [],
  "status": 500,
  "exit": 1,
  "stack": "Error\n    at new FirebaseError (/Users/myrepo/node_modules/firebase-tools/src/error.js:11:16)\n    at module.exports (/Users/myrepo/node_modules/firebase-tools/src/responseToError.js:46:10)\n    at Request._callback (/Users/myrepo/node_modules/firebase-tools/src/api.js:50:25)\n    at Request.self.callback (/Users/myrepo/node_modules/request/request.js:185:22)\n    at emitTwo (events.js:126:13)\n    at Request.emit (events.js:214:7)\n    at Request.<anonymous> (/Users/myrepo/node_modules/request/request.js:1161:10)\n    at emitOne (events.js:116:13)\n    at Request.emit (events.js:211:7)\n    at IncomingMessage.<anonymous> (/Users/myrepo/node_modules/request/request.js:1083:12)",
  "context": {
    "body": {
      "error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "status": "INVALID_ARGUMENT"
      }
    },
    "response": {
      "statusCode": 400,
      "body": {
        "error": {
          "code": 400,
          "message": "Request contains an invalid argument.",
          "status": "INVALID_ARGUMENT"
        }
      },
      "headers": {
        "vary": "X-Origin, Referer, Origin,Accept-Encoding",
        "content-type": "application/json; charset=UTF-8",
        "date": "Thu, 15 Nov 2018 18:33:41 GMT",
        "server": "ESF",
        "cache-control": "private",
        "x-xss-protection": "1; mode=block",
        "x-frame-options": "SAMEORIGIN",
        "x-content-type-options": "nosniff",
        "alt-svc": "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"",
        "accept-ranges": "none",
        "connection": "close"
      },
      "request": {
        "uri": {
          "protocol": "https:",
          "slashes": true,
          "auth": null,
          "host": "mobilesdk-pa.googleapis.com",
          "port": 443,
          "hostname": "mobilesdk-pa.googleapis.com",
          "hash": null,
          "search": null,
          "query": null,
          "pathname": "/v1/projects/465836249868/clients/_:getWebAppConfig",
          "path": "/v1/projects/465836249868/clients/_:getWebAppConfig",
          "href": "https://mobilesdk-pa.googleapis.com/v1/projects/465836249868/clients/_:getWebAppConfig"
        },
        "method": "GET"
      }
    }
  }
}

编辑截至下午 1:16 MT,我不再看到此错误

我们已经回滚了导致此问题的后端构建。 你现在可以试试这个,看看它是否仍然坏了?

为我工作

+1 现在工作。 谢谢

+1 也确认为我工作。

+1 返回业务

@ryanpbrewster是的,它又开始工作了。 谢谢! 你们应该为此进行某种 e2e 测试

ps:它在没有任何重启的情况下工作,但我发现了一些挂起的节点进程并在firebase serve之前杀死了它们

即使在重新启动后,我仍然在运行之前的部署尝试中的进程。 我刚刚进入顶部并手动杀死它们,现在 firebase 工具对我来说很好用。

+1 全部设置! Tks 很多。

感谢大家的耐心等待。 无效参数错误已解决。

现在尝试在“firebase 部署”中解决问题 5 个小时。

功能是:

exports.makeUppercase = functions.database.ref('/userfollowers/{pushId}/followers')
    .onWrite((change, context) => {
      // Only edit data when it is first created.
      if (change.before.exists()) {
        return null;
      }
      // Exit when the data is deleted.
      if (!change.after.exists()) {
        return null;
      }
      // Grab the current value of what was written to the Realtime Database.
      const original = change.after.val();
      console.log('Uppercasing', context.params.pushId, original);
      const uppercase = original.toUpperCase();
      // You must return a Promise when performing asynchronous tasks inside a Functions such as
      // writing to the Firebase Realtime Database.
      // Setting an "uppercase" sibling in the Realtime Database returns a Promise.
      return change.after.ref.parent.child('uppercase').set(uppercase);
    });

这是直接的文档。

终端显示:

⚠  functions: failed to create function makeUppercase
HTTP Error: 400, The request has errors

云功能日志显示:
{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":3,"message":"INVALID_ARGUMENT"},"authenticationInfo":{"principalEmail":"[email protected]"},"requestMetadata":{"callerIp":"86.120.235.246","callerSuppliedUserAgent":"FirebaseCLI/3.19.0,gzip(gfe),gzip(gfe)","requestAttributes":{"time":"2019-05-14T08:34:18.563Z","auth":{}},"destinationAttributes":{}},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.CreateFunction","authorizationInfo":[{"resource":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase","permission":"cloudfunctions.functions.create","granted":true,"resourceAttributes":{}},{"permission":"cloudfunctions.functions.create","granted":true,"resourceAttributes":{}}],"resourceName":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase","request":{"location":"projects/parkour-9136c/locations/us-central1","@type":"type.googleapis.com/google.cloud.functions.v1.CreateFunctionRequest","function":{"labels":{"deployment-tool":"cli-firebase"},"entryPoint":"makeUppercase","eventTrigger":{"eventType":"providers/google.firebase.database/eventTypes/ref.write","resource":"projects/_/instances/parkour-9136c/refs/userfollowers/{pushId}/followers","service":"firebaseio.com"},"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-f5adb7fe-7321-4f3c-8fe0-2b2307d26138/5b099ea8-161b-44a7-a3bd-18ce75c64859.zip?GoogleAccessId=service-807137615499@gcf-admin-robot.iam.gserviceaccount.com&Expires=1557824657&Signature=PJKzJsZtHWO1kIkmrSojpdgvb0jRzV91eNC9rZc4j%2FMcoHjILGm36FKCt6qQ2fxeAUu1%2FbrxpagdI7fHmUUUrDdTmnTNISr7FiN61sifUI%2B%2FGnUwo8SguzvrA7kADFqu8nD05FAo7BvG7biUrHmLgISlwo5dTKqcTSmExnaICA1tHYxjz%2Fk0RbmdGkcQ5HdeCKBnW0R7wQPsxswQyvR4cAU4WD2m3PPM9lncVr7pB%2Fh77FboGLi3sq%2FGHyEwUtjfUmyN9d%2FYUpKs48TMsGPknAGIvaFFUWQR23YCDUcrPipq1nW2W1JUdf5nGylYmVEeyF3jLrm%2BsOIcXiZ6LCRhpg%3D%3D","name":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase"}}}

解决办法是什么?
谢谢

@nicoara请用所需信息打开一个新问题。 谢谢你。

现在尝试在“firebase 部署”中解决问题 5 个小时。

功能是:

exports.makeUppercase = functions.database.ref('/userfollowers/{pushId}/followers')
    .onWrite((change, context) => {
      // Only edit data when it is first created.
      if (change.before.exists()) {
        return null;
      }
      // Exit when the data is deleted.
      if (!change.after.exists()) {
        return null;
      }
      // Grab the current value of what was written to the Realtime Database.
      const original = change.after.val();
      console.log('Uppercasing', context.params.pushId, original);
      const uppercase = original.toUpperCase();
      // You must return a Promise when performing asynchronous tasks inside a Functions such as
      // writing to the Firebase Realtime Database.
      // Setting an "uppercase" sibling in the Realtime Database returns a Promise.
      return change.after.ref.parent.child('uppercase').set(uppercase);
    });

这是直接的文档。

终端显示:

⚠  functions: failed to create function makeUppercase
HTTP Error: 400, The request has errors

云功能日志显示:
{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":3,"message":"INVALID_ARGUMENT"},"authenticationInfo":{"principalEmail":"[email protected]"},"requestMetadata":{"callerIp":"86.120.235.246","callerSuppliedUserAgent":"FirebaseCLI/3.19.0,gzip(gfe),gzip(gfe)","requestAttributes":{"time":"2019-05-14T08:34:18.563Z","auth":{}},"destinationAttributes":{}},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.CreateFunction","authorizationInfo":[{"resource":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase","permission":"cloudfunctions.functions.create","granted":true,"resourceAttributes":{}},{"permission":"cloudfunctions.functions.create","granted":true,"resourceAttributes":{}}],"resourceName":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase","request":{"location":"projects/parkour-9136c/locations/us-central1","@type":"type.googleapis.com/google.cloud.functions.v1.CreateFunctionRequest","function":{"labels":{"deployment-tool":"cli-firebase"},"entryPoint":"makeUppercase","eventTrigger":{"eventType":"providers/google.firebase.database/eventTypes/ref.write","resource":"projects/_/instances/parkour-9136c/refs/userfollowers/{pushId}/followers","service":"firebaseio.com"},"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-f5adb7fe-7321-4f3c-8fe0-2b2307d26138/5b099ea8-161b-44a7-a3bd-18ce75c64859.zip?GoogleAccessId=service-807137615499@gcf-admin-robot.iam.gserviceaccount.com&Expires=1557824657&Signature=PJKzJsZtHWO1kIkmrSojpdgvb0jRzV91eNC9rZc4j%2FMcoHjILGm36FKCt6qQ2fxeAUu1%2FbrxpagdI7fHmUUUrDdTmnTNISr7FiN61sifUI%2B%2FGnUwo8SguzvrA7kADFqu8nD05FAo7BvG7biUrHmLgISlwo5dTKqcTSmExnaICA1tHYxjz%2Fk0RbmdGkcQ5HdeCKBnW0R7wQPsxswQyvR4cAU4WD2m3PPM9lncVr7pB%2Fh77FboGLi3sq%2FGHyEwUtjfUmyN9d%2FYUpKs48TMsGPknAGIvaFFUWQR23YCDUcrPipq1nW2W1JUdf5nGylYmVEeyF3jLrm%2BsOIcXiZ6LCRhpg%3D%3D","name":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase"}}}

解决办法是什么?
谢谢

现在尝试在“firebase 部署”中解决问题 5 个小时。

功能是:

exports.makeUppercase = functions.database.ref('/userfollowers/{pushId}/followers')
    .onWrite((change, context) => {
      // Only edit data when it is first created.
      if (change.before.exists()) {
        return null;
      }
      // Exit when the data is deleted.
      if (!change.after.exists()) {
        return null;
      }
      // Grab the current value of what was written to the Realtime Database.
      const original = change.after.val();
      console.log('Uppercasing', context.params.pushId, original);
      const uppercase = original.toUpperCase();
      // You must return a Promise when performing asynchronous tasks inside a Functions such as
      // writing to the Firebase Realtime Database.
      // Setting an "uppercase" sibling in the Realtime Database returns a Promise.
      return change.after.ref.parent.child('uppercase').set(uppercase);
    });

这是直接的文档。

终端显示:

⚠  functions: failed to create function makeUppercase
HTTP Error: 400, The request has errors

云功能日志显示:
{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":3,"message":"INVALID_ARGUMENT"},"authenticationInfo":{"principalEmail":"[email protected]"},"requestMetadata":{"callerIp":"86.120.235.246","callerSuppliedUserAgent":"FirebaseCLI/3.19.0,gzip(gfe),gzip(gfe)","requestAttributes":{"time":"2019-05-14T08:34:18.563Z","auth":{}},"destinationAttributes":{}},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.CreateFunction","authorizationInfo":[{"resource":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase","permission":"cloudfunctions.functions.create","granted":true,"resourceAttributes":{}},{"permission":"cloudfunctions.functions.create","granted":true,"resourceAttributes":{}}],"resourceName":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase","request":{"location":"projects/parkour-9136c/locations/us-central1","@type":"type.googleapis.com/google.cloud.functions.v1.CreateFunctionRequest","function":{"labels":{"deployment-tool":"cli-firebase"},"entryPoint":"makeUppercase","eventTrigger":{"eventType":"providers/google.firebase.database/eventTypes/ref.write","resource":"projects/_/instances/parkour-9136c/refs/userfollowers/{pushId}/followers","service":"firebaseio.com"},"sourceUploadUrl":"https://storage.googleapis.com/gcf-upload-us-central1-f5adb7fe-7321-4f3c-8fe0-2b2307d26138/5b099ea8-161b-44a7-a3bd-18ce75c64859.zip?GoogleAccessId=service-807137615499@gcf-admin-robot.iam.gserviceaccount.com&Expires=1557824657&Signature=PJKzJsZtHWO1kIkmrSojpdgvb0jRzV91eNC9rZc4j%2FMcoHjILGm36FKCt6qQ2fxeAUu1%2FbrxpagdI7fHmUUUrDdTmnTNISr7FiN61sifUI%2B%2FGnUwo8SguzvrA7kADFqu8nD05FAo7BvG7biUrHmLgISlwo5dTKqcTSmExnaICA1tHYxjz%2Fk0RbmdGkcQ5HdeCKBnW0R7wQPsxswQyvR4cAU4WD2m3PPM9lncVr7pB%2Fh77FboGLi3sq%2FGHyEwUtjfUmyN9d%2FYUpKs48TMsGPknAGIvaFFUWQR23YCDUcrPipq1nW2W1JUdf5nGylYmVEeyF3jLrm%2BsOIcXiZ6LCRhpg%3D%3D","name":"projects/parkour-9136c/locations/us-central1/functions/makeUppercase"}}}

解决办法是什么?
谢谢

尝试在 db ref 路径的末尾添加文档。 例如 /userfollowers/{pushId}/followers/{follower}

@bkendall我开始了一个新线程: https :

我运行了“firebase deploy --debug”并发现了一条新消息。

[2019-05-20T14:43:23.863Z] <<< HTTP RESPONSE 400 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Mon, 20 May 2019 14:43:23 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, connection=close
[2019-05-20T14:43:23.863Z] <<< HTTP RESPONSE BODY code=400, message=The request has errors, status=INVALID_ARGUMENT, details=[@type=type.googleapis.com/google.rpc.BadRequest, fieldViolations=[field=runtime, description=Runtime field cannot be empty.]]
⚠  functions: failed to create function makeUppercase
HTTP Error: 400, The request has errors

@soclbz更改没有任何区别。

谢谢

获取相同的_“运行时字段不能为空”_ 错误:

[2019-06-06T18:51:31.127Z] <<< HTTP RESPONSE 400变化=X-Origin,Referer,Origin,Accept-Encoding,content-type=application/json; 字符集=UTF-8,日期=周四,2019 年 6 月 6 日 18:51:30 GMT,服务器=ESF,缓存控制=私有,x-xss-protection=0,x-frame-options=SAMEORIGIN,x-content-类型-
options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, connection=close
[2019-06-06T18:51:31.128Z] <<< HTTP RESPONSE BODY code=400, message=请求有错误, status=INVALID_ARGUMENT, details=[@type=type.googleapis.com/google.rpc.BadRequest , fieldViolations=[field=runtime, description=Runtime 字段不能为空。]]

在尝试部署 hello world 示例函数时,使用npx firebase init新创建的项目也会发生这种情况。

@stpch您使用的是旧版本的 CLI 吗? 请看#1317

@stpch您使用的是旧版本的 CLI 吗? 请看#1317

我正在使用最新版本:

我的不好,有一个旧的firebase-tools版本通过yarn ,它优先于npx 。 它现在可以使用最新版本。

此页面是否有帮助?
0 / 5 - 0 等级