aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.41k stars 2.11k forks source link

Cannot create URL for blob! SpeechRecognition ChatBot #9949

Closed ghena closed 1 year ago

ghena commented 2 years ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Interactions

Amplify Categories

interactions

Environment information

System: OS: Windows 10 10.0.19044 CPU: (4) x64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz Memory: 2.15 GB / 11.89 GB Binaries: Node: 14.18.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.19.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 8.1.1 - C:\Program Files\nodejs\npm.CMD Watchman: 20210110.135312.0 - C:\ProgramData\chocolatey\bin\watchman.EXE Browsers: Chrome: 101.0.4951.67 Edge: Spartan (44.19041.1266.0), Chromium (101.0.1210.53) Internet Explorer: 11.0.19041.1566 npmPackages: @babel/core: ^7.18.2 => 7.18.2 @babel/runtime: ^7.18.3 => 7.18.3 @react-native-async-storage/async-storage: ^1.17.5 => 1.17.5 @react-native-community/art: ^1.2.0 => 1.2.0 @react-native-community/eslint-config: ^3.0.2 => 3.0.2 @react-native-community/netinfo: ^8.3.0 => 8.3.0 @react-native-picker/picker: ^2.4.1 => 2.4.1 @react-native-voice/voice: ^3.2.4 => 3.2.4 @react-navigation/native: ^6.0.10 => 6.0.10 @react-navigation/stack: ^6.2.1 => 6.2.1 HelloWorld: 0.0.1 amazon-cognito-identity-js: ^5.2.9 => 5.2.9 aws-amplify: ^4.3.24 => 4.3.24 aws-amplify-react-native: ^6.0.4 => 6.0.4 babel-jest: ^28.1.0 => 28.1.0 eslint: ^8.16.0 => 8.16.0 example: 0.0.1 hermes-inspector-msggen: 1.0.0 jest: ^28.1.0 => 28.1.0 metro-react-native-babel-preset: ^0.71.0 => 0.71.0 (0.67.0) native-base: ^3.4.5 => 3.4.5 react: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-chatbot: ^0.0.1-alpha.12 => 0.0.1-alpha.12 react-native-fs: ^2.20.0 => 2.20.0 react-native-gesture-handler: ^2.4.2 => 2.4.2 react-native-image-picker: ^4.8.3 => 4.8.3 react-native-safe-area-context: ^4.2.5 => 4.2.5 react-native-sound: ^0.11.2 => 0.11.2 react-native-svg: ^12.3.0 => 12.3.0 react-native-swipe-modal-up-down: ^1.1.0 => 1.1.0 react-test-renderer: 17.0.2 => 17.0.2 styled-components: ^5.3.5 => 5.3.5 styled-components/macro: undefined () styled-components/native: undefined () styled-components/primitives: undefined () npmGlobalPackages: @aws-amplify/cli: 8.3.0 @expo/traveling-fastlane-linux: 1.12.0 bit-bin: 14.8.8 bower: 1.8.8 browserify: 14.4.0 compass: 0.1.1 cordova-res-generator: 0.4.2 cordova-res: 0.8.1 cordova: 9.0.0 electron-prebuilt: 1.4.13 expo-cli: 3.12.1 framework7-cli: 4.0.2 grunt-cli: 1.4.3 grunt: 1.4.1 gulp: 4.0.2 ionic: 4.1.2 kill-chrome: 2.2.0 lightcrawler: 0.0.9 lighthouse-cli: 0.1.2 lighthouse: 2.4.0 mvm: 0.2.0 npm-windows-upgrade: 6.0.1 npm: 8.1.1 nvm: 0.0.4 phonegap: 9.0.0 phplint: 1.7.4 plugman: 3.0.1 react-native-app-id-fixed: 0.2.1 react-native-cli: 2.0.1 react-native-rename: 2.4.1 selenium-standalone: 5.1.1 sharp-cli: 1.13.1 tinypng-cli: 0.0.7 to: 0.2.9 update: 0.7.4 webpack-dev-server: 2.11.5 webpack: 5.69.1 windows-build-tools: 5.2.2

Describe the bug

using a standard implementation , I would like to use speech recognigtion: import voiceLibs from 'aws-amplify-react-native/dist/Interactions/ReactNativeModules';

<ChatBot voiceEnabled={true} voiceLibs={voiceLibs} conversationModeOn={true} botName={botName} welcomeMessage={welcomeMessage} onComplete={this.handleComplete} clearOnComplete={false} textEnabled={true} styles={StyleSheet.create({ itemMe: { color: 'red' } })} />

After Speech recognition I get ERROR [ERROR] 07:08.93 ChatBot {"error": {"code": "5", "message": "5/Client side error"}} WARN Possible Unhandled Promise Rejection (id: 0): Error: Cannot create URL for blob!

Expected behavior

Just pass speech to amplify Lex and reply.

Please attention that:

I updated \node_modules\aws-amplify-react-native\dist\Interactions\ReactNativeModules\index.js

using '@react-native-voice/voice' instead of 'react-native-voice' I suppose this is another bug of aws-amplify-react-native.

Reproduction steps

yarn install react-native run-android

Code Snippet

<ChatBot voiceEnabled={true} voiceLibs={voiceLibs} conversationModeOn={true} botName={botName} welcomeMessage={welcomeMessage} onComplete={this.handleComplete} clearOnComplete={false} textEnabled={true} styles={StyleSheet.create({ itemMe: { color: 'red' } })} />

Log output

aws-exports.js

/ eslint-disable / // WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = { "aws_project_region": "eu-west-1", "aws_cognito_identity_pool_id": "xxxxxxx", "aws_cognito_region": "eu-west-1", "aws_user_pools_id": "eu-west-1_mG0N7xNII", "aws_user_pools_web_client_id": "yyyyyyyy", "oauth": {}, "aws_cognito_username_attributes": [ "EMAIL" ], "aws_cognito_social_providers": [], "aws_cognito_signup_attributes": [ "EMAIL" ], "aws_cognito_mfa_configuration": "OFF", "aws_cognito_mfa_types": [ "SMS" ], "aws_cognito_password_protection_settings": { "passwordPolicyMinLength": 8, "passwordPolicyCharacters": [] }, "aws_cognito_verification_mechanisms": [ "EMAIL" ], "aws_bots": "enable", "aws_bots_config": [ { "name": "ScheduleAppointment_dev", "alias": "$LATEST", "region": "eu-west-1" } ] };

export default awsmobile;

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

cwomack commented 1 year ago

Hello @ghena, and apologies for the delayed response on this issue. It looks like you may have been using the "legacy" chatbot that is deprecated. If you're still trying to implement this in a React Native app, can you see if upgrading to the most recent version of Amplify and walking through the updated docs for Getting Started with Interactions helps to get your chat bot up and running?

I'm not sure if you were trying to use this example of a React Native component, but you can also create your own component using the API's that Amplify-JS supplies. Keep in mind there's also a Lex V1 bot and a Lex V2 bot that have different instructions for implementation if you do a manual setup.

Let us know if you're still working on this, and apologies we didn't get back sooner!

cwomack commented 1 year ago

@ghena, I'll close this issue for now since we haven't heard back... but please feel free to respond once you get a chance to review the above comment. Should you experience any issues trying to use the newer documentation for Interactions or with getting Lex V1/V2 bots up and running, we'll gladly reopen this issue and get you a more timely response on it!