react-native-aws3
react-native-aws3 copied to clipboard
[Unhandled promise rejection: TypeError: undefined is not an object (evaluating '_reactNativeAws2.default.put')]
Why is it that I'm getting this error? I don't understand. the full error stack is:
[Unhandled promise rejection: TypeError: undefined is not an object (evaluating '_reactNativeAws2.default.put')]
- screens/common/create-visual-guideline.js:141:19 in uploadFiles$
- node_modules/react-native/node_modules/regenerator-runtime/runtime.js:63:44 in tryCatch
- node_modules/react-native/node_modules/regenerator-runtime/runtime.js:337:30 in invoke
- node_modules/react-native/node_modules/regenerator-runtime/runtime.js:63:44 in tryCatch
- node_modules/react-native/node_modules/regenerator-runtime/runtime.js:139:28 in invoke
- node_modules/react-native/node_modules/regenerator-runtime/runtime.js:184:17 in
- node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
- node_modules/promise/setimmediate/core.js:200:23 in doResolve
- node_modules/promise/setimmediate/core.js:66:12 in Promise
- node_modules/react-native/node_modules/regenerator-runtime/runtime.js:183:27 in callInvokeWithMethodAndArg
- node_modules/react-native/node_modules/regenerator-runtime/runtime.js:206:12 in enqueue
- node_modules/react-native/node_modules/regenerator-runtime/runtime.js:226:8 in async
- null:null in uploadFiles
- screens/common/create-visual-guideline.js:131:8 in post
- screens/common/create-visual-guideline.js:190:49 in onPress
- node_modules/react-native/Libraries/Components/Touchable/TouchableOpacity.js:193:45 in touchableHandlePress
- node_modules/react-native/Libraries/Components/Touchable/Touchable.js:746:34 in _performSideEffectsForTransition
this create-visual-guideline.js:141:19 in uploadFiles$
is as follows:
import aws3Client from 'react-native-aws3';
aws3Client.put(file, AWS_OPTIONS)
.progress((e) => {
console.log(e.loaded / e.total);
let progress = this.state.fileprogress;
progress[i] = e.loaded / e.total;
this.setState({fileprogress: progress});
});
You can close the issue. My bad. I'm not importing the right object.
my import:
import aws3Client from 'react-native-aws3';
instead should be uses:
import { RNS3 } from 'react-native-aws3';