FIREBASE警告:无效的查询字符串段-部署简单的Firebase Cloud函数时发出警告 [英] FIREBASE WARNING: Invalid query string segment - Warning when deploying simple Firebase Cloud function

查看:106
本文介绍了FIREBASE警告:无效的查询字符串段-部署简单的Firebase Cloud函数时发出警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天早上,我开始注意到我的函数日志中出现大量"FIREBASE警告:无效的查询字符串段" 错误.为了弄清楚到底发生了什么,我最终对功能进行了各种更改,并多次部署了所有云功能.

This morning I started noticing a large amount of "FIREBASE WARNING: Invalid query string segment" errors in my functions log. In an attempt to figure out what was going on I ended up making various changes to function and deploying all my cloud functions several times.

在执行此操作时,我注意到我在某个函数上遇到了错误:

While doing this I noticed that I was getting the error on a function that:

  1. 其中没有Firebase查询.
  2. 几个月内没有被调用(这是一个测试功能).

这使我相信Firebase Cloud Functions最近进行了更改,无论该功能是否与实时数据库查询有任何关系,Firebase Cloud Functions可能会偶尔在部署和/或执行云功能时生成此错误.是否有其他人注意到此错误或对为什么会发生有任何了解?

This leads me to believe that a change was made Firebase Cloud Functions recently that may be sporadically generating this error on deploy and/or execution of cloud functions regardless of whether the function has anything to do with real time database queries. Has anybody else noticed this error or have any insight into why it is occurring?

我的云index.js文件的相关部分如下(应该足以复制问题):

Relevant part of my cloud index.js file is as follows (should be enough to replicate the issue):

const cors = require('cors')({origin: true});
const functions = require('firebase-functions');
const admin = require('firebase-admin');

const firebaseRef = admin.database().ref();
const firestoreRef = admin.firestore();

exports.testCloudFunctions = functions.https.onRequest((request, response) => {
  cors(request, response, () => {
    const params = request.query;
    console.log(params)
    response.status(200).send({success: true, message: "Test Successful", params: params});
  });
});

推荐答案

在与Firebase支持进行交谈之后,我了解到该错误是在npm依赖项@firebase/database: 0.1.10中引入的.如果您还具有最新的firebase-admin依赖关系,则将具有此依赖关系.

After talking with Firebase support, I learned this bug was introduced in the npm dependency @firebase/database: 0.1.10. You will have this dependency if you also have the latest firebase-admin dependency.

警告

对功能的整体处理没有任何影响.

shouldn't have any impact on the function's overall processing.

如果要删除警告,则可以强制将npm依赖项设置为@firebase/database: 0.1.9.我测试了此调整,并从Firebase控制台日志中删除了警告.

If you want to remove the warning, you can force the npm dependency of @firebase/database: 0.1.9. I tested this adjustment and the warning was removed from my Firebase Console Logs.

支持代理还表示已完成修复,但尚未发布,因此我希望@firebase/database: 0.1.11 +不会遇到此错误.

The support agent also stated the fix has been made, but not released, so I would expect @firebase/database: 0.1.11+ to not experience this bug.

这篇关于FIREBASE警告:无效的查询字符串段-部署简单的Firebase Cloud函数时发出警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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