t3chnoboy / amazon-product-api

:credit_card: Amazon Product Advertising API client
365 stars 104 forks source link

You are submitting requests too quickly. Please retry your requests at a slower rate #104

Open dheekshas opened 6 years ago

dheekshas commented 6 years ago

I am getting this error though I am not making multiple calls at a time. My first call itself has thrown this error as per my log. Same API call is working after some time. Please guide me how to solve this issue.

Function usage:

var client = amazon.createClient({ awsId: "XXXXXXXXXXXXXXXXXXX", awsSecret: "YYYYYYYYYYYYYYYYYYYYYYY", awsTag: "ZZZZZZZZZZZZZZ" });

console.log("Before making Amazon API"); client.itemLookup({ idType: 'ASIN', itemId: BBBBBBBBBB, //This is valid amazon ASIN id domain: 'webservices.amazon.in' }).then(function (results) { var result = JSON.stringify(results); console.log("amaz success" + result);

    res.send(result);
}).catch(function (err) {
console.log("amaz error" + err);
var result = JSON.stringify(err);
result = "ErrorOccured" + result;
    res.send(result);        
});

Error:

{\"$\":{\"xmlns\":\"http://ecs.amazonaws.com/doc/2013-08-01/\"},\"Error\":[{\"Code\":[\"RequestThrottled\"],\"Message\":[\"AWS Access Key ID: XXXXXXXXXXXXXXXX. You are submitting requests too quickly. Please retry your requests at a slower rate.\"]}],\"RequestID\":[\"5b1b2a16-1870-4884-9543-26d463955d94\"]}"

andreabisello commented 6 years ago

Same issue, and i'm running code manually, very slowly. Here there are some info about limit (http://docs.aws.amazon.com/AWSECommerceService/latest/DG/TroubleshootingApplications.html)

masterT commented 6 years ago

Check this issue https://github.com/t3chnoboy/amazon-product-api/issues/37

50l3r commented 5 years ago

Same issue,

I only execute one request in my code:

const amazon = require('amazon-product-api');
const credentials = require('./credentials.json');

const client = amazon.createClient(credentials);

client.itemSearch({
    director: 'Quentin Tarantino',
    actor: 'Samuel L. Jackson',
    searchIndex: 'DVD',
    audienceRating: 'R',
    responseGroup: 'ItemAttributes,Offers,Images',
}).then((results) => {
    console.log('OK');
    console.log(results);
}).catch((err) => {
    console.log('ERROR');
    console.log(err.Error);
});

Error: [ { Code: [ 'RequestThrottled' ], Message: [ 'AWS Access Key ID: XXXXXXXXXXXXXXXXXXX. You are submitting requests too quickly. Please retry your requests at a slower rate.' ] } ]

50l3r commented 5 years ago

Solved adding the domain in request:

domain: 'webservices.amazon.es'

Deepjyoti120 commented 5 years ago

how to add this

geremora commented 5 years ago

Solved using https://github.com/jhurliman/node-rate-limiter

Something like:

const RateLimiter = require('limiter').RateLimiter;
const limiter = new RateLimiter(1, 2000);

limiter.removeTokens(1, function() {
 client.itemLookup({...})
})
adampatterson commented 4 years ago

Might be related to some changes made to their API operating agreement.

https://docs.aws.amazon.com/AWSECommerceService/latest/DG/TroubleshootingApplications.html

Note that your account will lose access to Product Advertising API if it has not generated referring sales for a consecutive 30-day period.

I also read that in order to qualify access you need to make three sales, although I can not find that at this time.

adampatterson commented 4 years ago

Found it:

https://associates.amazon.ca/assoc_credentials/home

How do I get access to PA API? In order to qualify for requesting access to PA API, you will need an associate account, you will have to complete three qualifying sales in the first 180 days and you will have to comply with the Operating Agreement. Once your account has been approved as an associate account, you will see a 'Request for PA API access' button below. You can click the button to get access to PA API.