marcy-terui / serverless-alexa-skills

Manage your Alexa Skills with Serverless Framework
https://www.npmjs.com/package/serverless-alexa-skills
MIT License
71 stars 13 forks source link

get model API will be throttled #26

Open hideokamoto opened 5 years ago

hideokamoto commented 5 years ago

When I build my skill by your command, I've got the following error.

$ sls alexa build -d
  Status Code Error --------------------------------------

  429 - "{\"message\":\"We are experiencing heavy traffic at the moment. Please try again later.\"}"

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           10.5.0
     Serverless Version:     1.34.1

I think when the developer has a lot of skills, the SMAP API will be throttled. I debug your script and I found the error position. There: https://github.com/marcy-terui/serverless-alexa-skills/blob/master/lib/AlexaApi.js#L113

I've add the following debug code.

  getModels(vendorId) {
    return BbPromise.bind(this)
      .then(() => this.getSkills(vendorId).then(skills => console.log(skills.length)))
      .then(function () {
        return BbPromise.resolve(this.getSkills(vendorId));
      })
      .map(function (skill) {

this.getSkills(vendorId) will returns huge lists (the length is 50).

Could you add setInterval or sleep method to to avoid the throttling? Thanks !