Closed ancashoria closed 6 years ago
I am having this issue with "locale": "en-US"
in my request. I checked my linux server and that locale is selected and available. Any ideas?
Same question here....looking at the source code. It looks like it only deals with lamba in which the request is mutated and not one to one of a request of a normal node server(ie: it doesn't not look for locale on body.request.locale for value).
Anyone know????
Hi Ancashoria, A normal lambda event will have a json body similar to the following:
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.[unique-value-here]",
"application": {
"applicationId": "amzn1.ask.skill.[unique-value-here]"
},
"attributes": {
"key": "string value"
},
"user": {
"userId": "amzn1.ask.account.[unique-value-here]",
"accessToken": "Atza|AAAAAAAA...",
"permissions": {
"consentToken": "ZZZZZZZ..."
}
}
},
"context": {
"System": {
"device": {
"supportedInterfaces": {
"AudioPlayer": {}
}
},
"application": {
"applicationId": "amzn1.ask.skill.[unique-value-here]"
},
"user": {
"userId": "amzn1.ask.account.[unique-value-here]",
"accessToken": "Atza|AAAAAAAA...",
"permissions": {
"consentToken": "ZZZZZZZ..."
}
},
"apiEndpoint": "https://api.amazonalexa.com"
},
"AudioPlayer": {
"playerActivity": "PLAYING",
"token": "audioplayer-token",
"offsetInMilliseconds": 0
}
},
"request": {}
}
Inside the sdk, there's a HandleLambdaEvent()
method in which the sdk is trying to retrieve locale using this.locale = this._event.request.locale;
. SDK is written under assumption that event object will have a similar structure as above.
It seems that in your code, only request
is passed into Alexa.handler()
. which will cause this.locale = this._event.request.locale;
to fail.
Hope this helps!
The question was already answered in another issue: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/72
I disagree, it was not actually answered.
Maybe this is what you are looking for? https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/263#issuecomment-355988626
It works very nicely in conjuction with the is-lambda package (https://www.npmjs.com/package/is-lambda).
Hi, I'm trying to use the sdk outside lambda but I get this error:
Cannot read property 'locale' of undefined
Here's my code:
The code that works on lambda is almost the same except for the objects passed to
Alexa.handler()
Here it is:
Am I doing something wrong, or it's not possible to use this sdk outside of lambda?