I'm trying to use the AWS SDK for JavaScript in a React Native application.
I created a AWS.Comprehend
object and after configuring the credentials and call the detectDominantLanguage
method the console displays the following error:
[NetworkingError: Network Failure] Network Failure http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:132243:49dispatchEvent@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:34133:31setReadyState@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:33217:33__didCompleteResponse@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:33044:29emit@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:3420:42__callFunction@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2748:49http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2470:31__guard@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2702:15callFunctionReturnFlushedQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2469:21callFunctionReturnFlushedQueue@[native code]
The following code snippet shows how I configured the application. Some code was removed for brevity:
import AWS from 'aws-sdk/dist/aws-sdk-react-native';AWS.config.update({ accessKeyId: '#', // the # is just a placeholder, not the real value secretAccessKey: '#', // the # is just a placeholder, not the real value region: 'sa-east-1'});const comprehend = new AWS.Comprehend();export default class DominantLanguageScreen extends Component { render() { comprehend.detectDominantLanguage(params, function (err, data) { if (err) console.log(err, err.message, err.stack); else { console.log(JSON.stringify(data)); } }); return (...); }}
I'm running the application on a physical android device.