You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asynconUpload(fileArr){if(fileArr.length>0){console.log("fileArr",fileArr);fileArr.map(async(obj)=>{try{console.log({ Storage, Amplify });console.log("Object =>",obj);letbaseData=awaitthis.toBase64(obj);console.log("Base Data =>",baseData);constarrayBuffer=decode(baseData);console.log("Array buffer =>",arrayBuffer);letresult=awaitStorage.put(`hub/${obj.name}`,arrayBuffer,{contentType: obj.type,});console.log("S3 Upload Result =>",result);}catch(err){console.log("Error in uploading",err);}});}},
// Put your code below this line.asynconUpload(fileArr){if(fileArr.length>0){console.log("fileArr",fileArr);fileArr.map(async(obj)=>{try{console.log({ Storage, Amplify });console.log("Object =>",obj);letbaseData=awaitthis.toBase64(obj);console.log("Base Data =>",baseData);constarrayBuffer=decode(baseData);console.log("Array buffer =>",arrayBuffer);letresult=awaitStorage.put(`hub/${obj.name}`,arrayBuffer,{contentType: obj.type,});console.log("S3 Upload Result =>",result);}catch(err){console.log("Error in uploading",err);}});}},
Log output
// Put your logs below this line
[DEBUG] 53:00.104 AWSS3Provider - put hub/Screenshot from 2021-08-05 16-40-08.png to public/hub/Screenshot from 2021-08-05 16-40-08.png
ConsoleLogger.js?36de:127 [DEBUG] 53:00.106 Credentials - getting credentials
ConsoleLogger.js?36de:127 [DEBUG] 53:00.106 Credentials - picking up credentials
ConsoleLogger.js?36de:127 [DEBUG] 53:00.107 Credentials - getting new cred promise
ConsoleLogger.js?36de:127 [DEBUG] 53:00.107 Credentials - checking if credentials exists and not expired
ConsoleLogger.js?36de:127 [DEBUG] 53:00.107 Credentials - need to get a new credential or refresh the existing one
ConsoleLogger.js?36de:127 [DEBUG] 53:00.107 Credentials - no credentials for expiration check
ConsoleLogger.js?36de:127 [DEBUG] 53:00.108 AuthClass - Getting current user credentials
ConsoleLogger.js?36de:127 [DEBUG] 53:00.108 AuthClass - Getting current session
ConsoleLogger.js?36de:127 [DEBUG] 53:00.109 AuthClass - Failed to get user from user pool
ConsoleLogger.js?36de:139 [DEBUG] 53:00.109 AuthClass - Failed to get the current user No current user
ConsoleLogger.js?36de:139 [DEBUG] 53:00.109 AuthClass - getting session failed No current user
ConsoleLogger.js?36de:127 [DEBUG] 53:00.109 Credentials - setting credentials for guest
ConsoleLogger.js?36de:139 [DEBUG] 53:00.116 Credentials - Failed to load credentials Promise {<rejected>: TypeError: Cannot read property 'body' of undefined
at window.fetch (webpack-internal:///./src/…}
ConsoleLogger.js?36de:139 [DEBUG] 53:00.117 Credentials - Error loading credentials TypeError: Cannot read property 'body' of undefined
at window.fetch (backend.js?1ba4:7)
at FetchHttpHandler.handle (fetch-http-handler.js?cd6f:45)
at eval (GetIdCommand.js?44e3:41)
at eval (deserializerMiddleware.js?b14a:6)
at step (tslib.es6.js?9ab4:100)
at Object.eval [as next] (tslib.es6.js?9ab4:81)
at eval (tslib.es6.js?9ab4:74)
at new Promise (<anonymous>)
at __awaiter (tslib.es6.js?9ab4:70)
at eval (deserializerMiddleware.js?b14a:2)
ConsoleLogger.js?36de:139 [DEBUG] 53:00.117 AWSS3ProviderManagedUpload - set credentials for storage {accessKeyId: undefined, sessionToken: undefined, secretAccessKey: undefined, identityId: undefined, authenticated: undefined}
ConsoleLogger.js?36de:139 [WARN] 53:00.140 AWSS3Provider - error uploading TypeError: Cannot read property 'byteLength' of undefined
at Object.isEmptyData (isEmptyData.js?9103:8)
at Sha256.update (webCryptoSha256.js?6f83:21)
at Sha256.update (crossPlatformSha256.js?648c:23)
at hmac (credentialDerivation.js?4cf0:86)
at eval (credentialDerivation.js?4cf0:33)
at step (tslib.es6.js?9ab4:100)
at Object.eval [as next] (tslib.es6.js?9ab4:81)
at eval (tslib.es6.js?9ab4:74)
at new Promise (<anonymous>)
at __awaiter (tslib.es6.js?9ab4:70)
ConsoleLogger._log @ ConsoleLogger.js?36de:139
ConsoleLogger.warn @ ConsoleLogger.js?36de:197
eval @ AWSS3Provider.js?45d5:411
step @ AWSS3Provider.js?45d5:43
eval @ AWSS3Provider.js?45d5:24
rejected @ AWSS3Provider.js?45d5:16
Promise.then (async)
step @ AWSS3Provider.js?45d5:17
fulfilled @ AWSS3Provider.js?45d5:15
Promise.then (async)
step @ AWSS3Provider.js?45d5:17
eval @ AWSS3Provider.js?45d5:18
__awaiter @ AWSS3Provider.js?45d5:14
AWSS3Provider.put @ AWSS3Provider.js?45d5:326
Storage.put @ Storage.js?2d6c:270
_callee13$ @ ClaimForm.vue?69b3:1915
tryCatch @ aws-amplify-vue.common.js?19b2:10090
invoke @ aws-amplify-vue.common.js?19b2:10320
eval @ aws-amplify-vue.common.js?19b2:10145
asyncGeneratorStep @ asyncToGenerator.js?1da1:3
_next @ asyncToGenerator.js?1da1:25
Promise.then (async)
asyncGeneratorStep @ asyncToGenerator.js?1da1:13
_next @ asyncToGenerator.js?1da1:25
eval @ asyncToGenerator.js?1da1:32
eval @ asyncToGenerator.js?1da1:21
eval @ ClaimForm.vue?69b3:1915
_callee14$ @ ClaimForm.vue?69b3:1915
tryCatch @ aws-amplify-vue.common.js?19b2:10090
invoke @ aws-amplify-vue.common.js?19b2:10320
eval @ aws-amplify-vue.common.js?19b2:10145
asyncGeneratorStep @ asyncToGenerator.js?1da1:3
_next @ asyncToGenerator.js?1da1:25
eval @ asyncToGenerator.js?1da1:32
eval @ asyncToGenerator.js?1da1:21
onUpload @ ClaimForm.vue?69b3:1912
handler @ ClaimForm.vue?69b3:1456
invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1863
run @ vue.runtime.esm.js?2b0e:4584
flushSchedulerQueue @ vue.runtime.esm.js?2b0e:4326
eval @ vue.runtime.esm.js?2b0e:1989
flushCallbacks @ vue.runtime.esm.js?2b0e:1915
Promise.then (async)
timerFunc @ vue.runtime.esm.js?2b0e:1942
nextTick @ vue.runtime.esm.js?2b0e:1999
queueWatcher @ vue.runtime.esm.js?2b0e:4418
update @ vue.runtime.esm.js?2b0e:4560
notify @ vue.runtime.esm.js?2b0e:730
reactiveSetter @ vue.runtime.esm.js?2b0e:1055
proxySetter @ vue.runtime.esm.js?2b0e:4644
setFiles @ form-file.js?c43f:352
handleFiles @ form-file.js?c43f:401
onChange @ form-file.js?c43f:443
invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1863
invoker @ vue.runtime.esm.js?2b0e:2188
original._wrapper @ vue.runtime.esm.js?2b0e:6961
ClaimForm.vue?69b3:1932 Error in uploading TypeError: Cannot read property 'byteLength' of undefined
at Object.isEmptyData (isEmptyData.js?9103:8)
at Sha256.update (webCryptoSha256.js?6f83:21)
at Sha256.update (crossPlatformSha256.js?648c:23)
at hmac (credentialDerivation.js?4cf0:86)
at eval (credentialDerivation.js?4cf0:33)
at step (tslib.es6.js?9ab4:100)
at Object.eval [as next] (tslib.es6.js?9ab4:81)
at eval (tslib.es6.js?9ab4:74)
at new Promise (<anonymous>)
at __awaiter (tslib.es6.js?9ab4:70)
Hi @rakeshkumar331 👋 It seems you're calling Storage.put from within a map function, so I can't be sure what values are being passed to Storage.put. Could you confirm that only trying to upload one item works?
If uploading a single file works, you might want to wrap your map (which will return an array of promises), in a Promise.all and await it like so:
// Put your code below this line.asyncfunctiononUpload(fileArr){if(fileArr.length>0){console.log("fileArr",fileArr);awaitPromise.all(fileArr.map(async(obj)=>{try{console.log({ Storage, Amplify });console.log("Object =>",obj);letbaseData=awaitthis.toBase64(obj);console.log("Base Data =>",baseData);constarrayBuffer=decode(baseData);console.log("Array buffer =>",arrayBuffer);letresult=awaitStorage.put(`hub/${obj.name}`,arrayBuffer,{contentType: obj.type,});console.log("S3 Upload Result =>",result);}catch(err){console.log("Error in uploading",err);}}));}}
Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you. Thank you!
Before opening, please confirm:
JavaScript Framework
Vue
Amplify APIs
Storage
Amplify Categories
storage
Environment information
Describe the bug
My Code:
Expected behavior
Files should upload to S3 Storage
Reproduction steps
Install and configure
Code Snippet
Log output
aws-exports.js
const awsmobile = {
"aws_project_region": "eu-west-2",
"aws_cognito_identity_pool_id": "eu-west-2:xxx-xxxx-xxxx-xxxx-xxxxxxxx",
"aws_cognito_region": "eu-west-2",
"aws_user_pools_id": "eu-west-2_xxxxxxxx",
"aws_user_pools_web_client_id": "xxxxxxxx",
"oauth": {},
"aws_user_files_s3_bucket": "xxxxxxxx",
"aws_user_files_s3_bucket_region": "eu-west-2"
};
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
The text was updated successfully, but these errors were encountered: