Reputation: 1001
I am using Amazon S3 webservice to upload my file.
var req = bucket.putObject(params).on('httpUploadProgress', function (progress) {
....some action
}).send(function (err, data) {
console.log(err);
....some action
});
When I execute the above operation it gives me following error.
Error: No credentials to load
at i (https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:4:1104)
at i.a [as getCredentials] (https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:4:1645)
at a.u (https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:4:8229)
at a.h [as callListeners] (https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:5:84)
at a.l (https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:4:31779)
at a.v (https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:4:26057)
at a.n (https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:4:21730)
at n.i [as runTo] (https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:5:25078)
at https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:5:25381
at a.<anonymous> (https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min.js:4:21952)
When I again click on same button which execute the above, this time it works properly. What is the issue here
Upvotes: 0
Views: 143
Reputation: 78773
I would guess that the credentials have not been loaded by the time you make your first request. If you read the SDK source for getCredentials that raises this error, you'll see this comment: "If you want to ensure that your credentials are loaded prior to a request, you can use this method directly to provide accurate credential data stored in the object".
Upvotes: 1