aws-samples / aws-samples/aws-nodejs-sample

TypeError: TypeError: path must be a string or Buffer when calling

未关闭
#11 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
306
派生
168
PR 合并指标
30 天内没有已合并 PR

描述

I'm having trouble while calling Polly.

`Polly.synthesizeSpeech(params, (err, data) => {
if (err) {
console.log(err.code)
} else if (data) {
if (data.AudioStream instanceof Buffer) {
Fs.writeFile(argv.mp3, data.AudioStream, (err)=> {
if (err) {
return console.log(err)
}
console.log("The file was saved!")
var output = child_process.execSync('lame --decode ' + argv.mp3 + ' ' + '-b 8000' + ' ' + argv.wav + '.wav');
})
}
}
})
`

/opt/aws-nodejs-sample/node_modules/aws-sdk/lib/request.js:31
throw err;
^

TypeError: path must be a string or Buffer
at TypeError (native)
at Object.fs.open (fs.js:631:11)
at Object.fs.writeFile (fs.js:1303:6)
at Response. (/opt/aws-nodejs-sample/script.js:29:4)
at Request. (/opt/aws-nodejs-sample/node_modules/aws-sdk/lib/request.js:364:18)
at Request.callListeners (/opt/aws-nodejs-sample/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/opt/aws-nodejs-sample/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/opt/aws-nodejs-sample/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/opt/aws-nodejs-sample/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/opt/aws-nodejs-sample/node_modules/aws-sdk/lib/state_machine.js:14:12)

I have no idea how to fix this.

贡献指南

打开贡献指南

调研方向

从 script.js 第 29 行开始,堆栈跟踪指向 Fs.writeFile;检查在 Polly.synthesizeSpeech 回调之前 argv.mp3 是如何填充的。使用有效的输出路径重现该调用,并确认示例能够处理音频响应而不会出现与路径相关的 TypeError。

由索引模型根据 Issue 内容生成。

评估

技术栈
aws, javascript, node.js
领域
backend, cloud
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。