missing intent in request: {SLOT} TypeError: Cannot read property 'value' of undefined
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?
See if HEAD resolves this? I believe it was fixed in https://github.com/alexa-js/alexa-app/pull/184.
Doesn't seem like that fixed it
It is still not fixed
Looking forward to a PR from someone with a spec + fix.
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.
{ "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?
"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?