google-cloud-storage - 对 async/await 中的 google eslint 错误的操作
问题描述
我已将一些示例录音上传到 firebase 云存储,然后我尝试使用 SSML 将这些录音包含在 google 操作语音中。但我面临的问题是,由于 eslint 错误,我无法将云功能部署到 firebase,该错误显示在 async conv对象旁边。它说Parsing error: Unexpected token conv eslint 我正在关注这篇中等帖子https://medium.com/google-developers/using-cloud-storage-for-firebase-for-hosting-rich-media-in-your -actions-a838977eb758用于实施,但它不起作用。
以下是错误的完整描述:部署函数运行命令:npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint /home/nish/Documents/Projects/Voice/functions
> eslint .
/home/nish/Documents/Projects/Voice/functions/index.js
17:44 error Parsing error: Unexpected token conv
✖ 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.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/nish/.npm/_logs/2019-04-02T18_17_17_639Z-
debug.log
Error: functions predeploy error: Command terminated with non-zero exit code1
这是代码
const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp(functions.config().firebase);
const bucket = admin.storage().bucket();
const bucketAccessConfig = {
action: "read",
expires: Date.now() + 1000 * 60 * 60
};
app.intent("Default Welcome Intent", async conv => {
// eslint-disable-line no-use-before-define
let intentName = "Default_Welcome_Intent";
Path = `${intentName}/${Math.floor(Math.random() * 4) + 1}.ogg`;
const soundFileRef = bucket.file(Path);
const [soundUrl] = await soundFileRef.getSignedUrl(bucketAccessConfig);
// console.log(Path);
// console.log(storage);
conv.ask(`<speak><audio src=${soundUrl}/></speak>`);
});
解决方案
推荐阅读
- wireshark - 从网页操作中获取请求 URL
- discord.js - 如果有使用 discordjs 的用户,请获取有关我的用户
- excel - 使用 SUMIF 时 Excel 中的奇怪总和
- c++ - Lambda 捕获与参数 - 任何性能差异?
- ffmpeg - 在FFmpeg中查找后获取帧显示编号的公式
- python - DateTimeInput() 小部件在日期和时间之间放置一个随机 T,导致 ValidationError
- ruby-on-rails - 如果哈希值是字符串,Ruby/Rails 返回哈希元素
- php - 无法向数据库插入数据 | 致命错误:未捕获的 PDOException:SQLSTATE [42000]:语法错误或访问冲突:1064
- visual-studio-code - Why does debugging with lldb in VSCode garble chinese characters?
- java - How can I draw over a GridPane of Rectangles with an Image? (JavaFX)