Closed lavarith closed 3 years ago
Additional note, if I change the command to PostTextCommand and send text, it works as expected and outputs the WhatTimeIsItIntent in the console.
Updated my webpack and followed this tutorial https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/cross-service-submitdata-browser-script.html and the error went away.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Describe the bug
After building and deploying my code, when I send an audio clip to Lex, the console reads "ReferenceError: Buffer is not defined". I've tried including Buffer as a dependency, but it appears to be some failure when the response is parsed by the browser that I can't seem to resolve.
The network shows appropriate header transcription based on what I asked (ie, if I say "what time is it" that's what is in the header). The output to console is also as expected if I use PostTextCommand instead of PostContentCommand, so, it seems to be a problem with the PostResponse object when dealing with audio.
Your environment
SDK version number
@aws-sdk/client-lex-runtime-service@3.9.0
Is the issue in the browser/Node.js/ReactNative?
Browser
Details of the browser/Node.js/ReactNative version
Paste output of
npx envinfo --browsers
ornode -v
orreact-native -v
Steps to reproduce
My index.js is fairly simple and utilizes jquery and lex-audio to export a wav.
The goal is to allow a user to press the spacebar, capture audio, and then send it to Lex and receive back the transcription.
index.js
Observed behavior
When I press spacebar, the audio is sent to Lex, and when the response is received, I get
ReferenceError: Buffer is not defined
When I check the network headers for the response, the headers look right (ie,. it says "what time is it" as the transcribed header from lex), but it is throwing up somewhere when it tries to parse the response.
Expected behavior
Console should output the response data.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Here is my webpack.config.js
And my package.json