小编Tri*_*day的帖子

Firebase函数从获取请求返回400

我的本地功能可以在上正常运行

firebase serve --only functions
Run Code Online (Sandbox Code Playgroud)

但是一旦将其部署到云中,我就无法使用邮递员向其发出相同的get请求。我在stackdriver上收到以下错误: Unexpected token u in JSON at position 0 at JSON.parse,我的请求返回以下内容:400. That’s an error.Your client has issued a malformed or illegal request. That’s all we know.

我在本地和Firebase中发送的数据是带有以下内容GET的类型的请求application/json{ "data": { "Celebrity_A": "Brad Pitt", "Celebrity_B": "Angelina Jolie" } }

与本地相比,firebase功能对远程有什么要求?

下面是我的功能开始:

// Main index.ts
exports.funct = functions.https.onRequest(functexp)

// functexp file
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
import * as _request from 'request';
const serviceAccount …
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-functions firebase-admin

3
推荐指数
1
解决办法
730
查看次数