alexa-app icon indicating copy to clipboard operation
alexa-app copied to clipboard

missing intent in request: {SLOT} TypeError: Cannot read property 'value' of undefined

Open tlovett1 opened this issue 8 years ago • 7 comments

I'm getting this error when the slot is empty:

missing intent in request: ZIPCODE TypeError: Cannot read property 'value' of undefined

My code is really simple:

app.intent('perdiem', {
    'slots': {
      'ZIPCODE': 'AMAZON.NUMBER'
    },
    'utterances': ['{|for} {|per} {diem|day} rates {|at|near|by|for} {-|ZIPCODE}']
  }, function(req, res) {
    const zipcode = req.slot('ZIPCODE', false);

    const reprompt = 'Where do you want per diem rates?';

    if (!zipcode) {
      const prompt = 'Tell me a valid zipcode.';
      res.say(prompt).reprompt(reprompt).shouldEndSession(false);
    } else {
      Government.getPerDiemRates(zipcode).then(function(rate) {
        voicead.sayWithAd('The current per diem rate is ' + rate + ' dollars', res);
      }, function() {
        debug('Error has occured.');
      });
    }

    return false;
  }
);

Why is this an error? Shouldn't it just return false to zipcode?

tlovett1 avatar Feb 19 '17 21:02 tlovett1

See if HEAD resolves this? I believe it was fixed in https://github.com/alexa-js/alexa-app/pull/184.

dblock avatar Feb 19 '17 23:02 dblock

Doesn't seem like that fixed it

tlovett1 avatar Feb 21 '17 04:02 tlovett1

It is still not fixed

shaikhzaid avatar Feb 15 '18 22:02 shaikhzaid

Looking forward to a PR from someone with a spec + fix.

dblock avatar Feb 16 '18 00:02 dblock

yes this is the same issue I was having in #314 . If Alexa gets an empty slot then the slot value ends up being undefined and so you get and error where you expect the defaultValue of false (in this case). Should be fixed.

user1m avatar Feb 23 '18 23:02 user1m

{ "errorMessage": "Cannot read property 'slots' of undefined", "errorType": "TypeError", "stackTrace": [ "Object.SayHello (/var/task/index.js:38:47)", "emitNone (events.js:106:13)", "AlexaRequestEmitter.emit (events.js:208:7)", "Object.LaunchRequest (/var/task/index.js:19:14)", "emitNone (events.js:106:13)", "AlexaRequestEmitter.emit (events.js:208:7)", "AlexaRequestEmitter.EmitEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:216:10)", "AlexaRequestEmitter.ValidateRequest (/var/task/node_modules/alexa-sdk/lib/alexa.js:181:23)", "AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:126:25)", "AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:100:31)" ] }

I'm also getting error like can anyone help me?

akash65 avatar Jul 18 '18 11:07 akash65

"request": { "type": "IntentRequest", "requestId": "amzn1.echo-api.request.5292afe2-03d8-4cc5-959f-54715d91322e", "timestamp": "2018-07-18T11:55:26Z", "locale": "en-US", "intent": { "name": "HelloWorldIntent", "confirmationStatus": "NONE", "slots": { "number": { "name": "number", "confirmationStatus": "NONE"

why i'm not getting value here?

akash65 avatar Jul 18 '18 11:07 akash65