question

AnastasiiaZubi avatar image
AnastasiiaZubi asked

got invalid reqiestId while sending progressive response

the progressive response stopped working one day and keeps returning an error 400 -"requestId not present or invalid"

I'm sure that request id is valid, because after progressive response fail the skill successfully send a full response. What can cause this issue?

alexa skills kitprogressiveresponsehosted skill
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Andy Whitworth avatar image
Andy Whitworth answered

Can you post up the JSON payload for a progressive response which causes the error.

And where are you getting the requestId value from ?

7 comments
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

  
                    
  1. {
  2. "header":{
  3. "requestId": aRequest.request.requestId // "amzn1.echo-api.request.a66b7cc4-1fa9-468e-bb4a-165590cf17d7"
  4. },
  5. "directive":{
  6. "type": "VoicePlayer.Speak",
  7. "speech": <speak>\nplease wait a minute\n</speak>
  8. }
  9. }

aRequest is the request sent to my skill.

0 Likes 0 ·
Andy Whitworth avatar image Andy Whitworth AnastasiiaZubi ·
That all looks good.

How are you sending the progressive response + the "final" response ? Any code would help.

0 Likes 0 ·
AnastasiiaZubi avatar image AnastasiiaZubi Andy Whitworth ·
progressiveResponceRequest = {
    url: aRequest.context.System.apiEndpoint + "/v1/directives",
    headers: {
        "Authorization": "Bearer " + aRequest.context.System.apiAccessToken,
        "Content-Type": "application/json"
    },
    json:  {
      "header":{ 
        "requestId": aRequest.request.requestId
      },
      "directive":{ 
        "type": "VoicePlayer.Speak",
        "speech": <speak>\nplease wait a minute\n</speak>
      }
    }
};
request.post(progressiveResponceRequest)
.then(() => callBackFunction({
    "version": "1.0",
    "response": {
      "outputSpeech": {
        "type": "PlainText",
        "ssml": "",
        "text": "Hello"
      },
      "reprompt": {
        "outputSpeech": {
          "type": "PlainText",
          "ssml": "",
          "text": ""
        }
      },
      "shouldEndSession": true,
      "directives": []
    }
  }))
.catch((e) => callBackFunction({
    "version": "1.0",
    "response": {
      "outputSpeech": {
        "type": "PlainText",
        "ssml": "",
        "text": "an error accured"
      },
      "reprompt": {
        "outputSpeech": {
          "type": "PlainText",
          "ssml": "",
          "text": ""
        }
      },
      "shouldEndSession": true,
      "directives": []
    }
  })))
0 Likes 0 ·
Show more comments