简体   繁体   English

如何为 onCall firebase 函数系统创建异步函数

[英]How to create async function for onCall firebase functions system

I'm trying to upload my cloud functions but I have an error during the upload :我正在尝试上传我的云功能,但在上传过程中出现错误:

  14:63  error  Parsing error: Unexpected token =>

The function :功能 :

exports.deleteUser = functions.https.onCall(async (data, ctx) => {
  //my code
}

The error is the arrow...错误是箭头...

But this error happen just when I deploy my functions on the cloud but with the emulator nothing appear.但是这个错误发生在我在云上部署我的函数但模拟器什么也没有出现时。

The code provided is correct, you most likely have eslint added and configured to default's which have very strict settings.提供的代码是正确的,您很可能添加了 eslint 并将其配置为具有非常严格设置的默认值。 Setting the Env value to es6 or newer should resolve this issue.将 Env 值设置为 es6 或更高版本应该可以解决此问题。

  env: {
    es6: true,
    node: true,
  },
  "parserOptions": {
    "ecmaVersion": 2018
  }

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

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