带有异步的firebase函数https.onRequest失败

时间:2018-06-25 02:49:35

标签: firebase google-cloud-functions eslint

我具有firebase功能

exports.oauth = functions.https.onRequest(async (request, response) => {

eslint会引发以下错误

  11:69  error  Parsing error: Unexpected token =>

✖ 1 problem (1 error, 0 warnings)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

这是什么问题?

1 个答案:

答案 0 :(得分:1)

Cloud Functions当前正在运行节点6,该节点在ECMAScript 2017中不支持异步/等待语法。如果要使用异步/等待,则应使用TypeScript或其他可转换为在节点6上运行的等效代码的工具