Fehlermeldung bei vorgefertigten Skill

Hier wird über die Entwicklung von Skills diskutiert.
Antworten
Benutzeravatar

Themenstarter
CmdKeen42
Beiträge: 31
Registriert: Do 2. Feb 2017, 01:00
Wohnort: Lutherstadt Wittenberg
Vorhandene Echos: 1
Vorhandene Echo Dots: 2

Mi 29. Nov 2017, 23:51

Hallo Community,
ich habe mir folgendes Buch bei Amazon gekauft: Einstieg in die Alexa Skill Entwicklung für Echo (Dot): Mit Beispielen in node.js Kindle Edition.

Leider funktioniert der erste Skill nicht, da ich immer die folgende Fehlermeldung bekomme:
--------------------------------------------------
TART RequestId: 73875ed4-d554-11e7-8fa5-87b0911a9ef3 Version: $LATEST
2017-11-29T22:27:15.253Z 73875ed4-d554-11e7-8fa5-87b0911a9ef3 TypeError: Cannot read property 'locale' of undefined
at AlexaRequestEmitter.HandleLambdaEvent (/var/task/node_modules/alexa-sdk/lib/alexa.js:103:38)
at AlexaRequestEmitter.value (/var/task/node_modules/alexa-sdk/lib/alexa.js:92:31)
at exports.handler (/var/task/index.js:145:11)
END RequestId: 73875ed4-d554-11e7-8fa5-87b0911a9ef3
REPORT RequestId: 73875ed4-d554-11e7-8fa5-87b0911a9ef3 Duration: 229.40 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 33 MB
RequestId: 73875ed4-d554-11e7-8fa5-87b0911a9ef3 Process exited before completing request
--------------------------------------------------

Hat jemand eine Idee, was schief läuft?

Achso: der Originalcode sieht so aus:


/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills
* nodejs skill development kit.
* This sample supports multiple lauguages. (en-US, en-GB, de-DE).
* The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
* as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-fact
**/

'use strict';

const Alexa = require('alexa-sdk');

const APP_ID = undefined; // TODO replace with your app ID (OPTIONAL).

const languageStrings = {
'en': {
translation: {
FACTS: [
'A year on Mercury is just 88 days long.',
'Despite being farther from the Sun, Venus experiences higher temperatures than Mercury.',
'Venus rotates anti-clockwise, possibly because of a collision in the past with an asteroid.',
'On Mars, the Sun appears about half the size as it does on Earth.',
'Earth is the only planet not named after a god.',
'Jupiter has the shortest day of all the planets.',
'The Milky Way galaxy will collide with the Andromeda Galaxy in about 5 billion years.',
'The Sun contains 99.86% of the mass in the Solar System.',
'The Sun is an almost perfect sphere.',
'A total solar eclipse can happen once every 1 to 2 years. This makes them a rare event.',
'Saturn radiates two and a half times more energy into space than it receives from the sun.',
'The temperature inside the Sun can reach 15 million degrees Celsius.',
'The Moon is moving approximately 3.8 cm away from our planet every year.',
],
SKILL_NAME: 'Space Facts',
GET_FACT_MESSAGE: "Here's your fact: ",
HELP_MESSAGE: 'You can say tell me a space fact, or, you can say exit... What can I help you with?',
HELP_REPROMPT: 'What can I help you with?',
STOP_MESSAGE: 'Goodbye!',
},
},
'en-US': {
translation: {
FACTS: [
'A year on Mercury is just 88 days long.',
'Despite being farther from the Sun, Venus experiences higher temperatures than Mercury.',
'Venus rotates counter-clockwise, possibly because of a collision in the past with an asteroid.',
'On Mars, the Sun appears about half the size as it does on Earth.',
'Earth is the only planet not named after a god.',
'Jupiter has the shortest day of all the planets.',
'The Milky Way galaxy will collide with the Andromeda Galaxy in about 5 billion years.',
'The Sun contains 99.86% of the mass in the Solar System.',
'The Sun is an almost perfect sphere.',
'A total solar eclipse can happen once every 1 to 2 years. This makes them a rare event.',
'Saturn radiates two and a half times more energy into space than it receives from the sun.',
'The temperature inside the Sun can reach 15 million degrees Celsius.',
'The Moon is moving approximately 3.8 cm away from our planet every year.',
],
SKILL_NAME: 'American Space Facts',
},
},
'en-GB': {
translation: {
FACTS: [
'A year on Mercury is just 88 days long.',
'Despite being farther from the Sun, Venus experiences higher temperatures than Mercury.',
'Venus rotates anti-clockwise, possibly because of a collision in the past with an asteroid.',
'On Mars, the Sun appears about half the size as it does on Earth.',
'Earth is the only planet not named after a god.',
'Jupiter has the shortest day of all the planets.',
'The Milky Way galaxy will collide with the Andromeda Galaxy in about 5 billion years.',
'The Sun contains 99.86% of the mass in the Solar System.',
'The Sun is an almost perfect sphere.',
'A total solar eclipse can happen once every 1 to 2 years. This makes them a rare event.',
'Saturn radiates two and a half times more energy into space than it receives from the sun.',
'The temperature inside the Sun can reach 15 million degrees Celsius.',
'The Moon is moving approximately 3.8 cm away from our planet every year.',
],
SKILL_NAME: 'British Space Facts',
},
},
'de': {
translation: {
FACTS: [
'Ein Jahr dauert auf dem Merkur nur 88 Tage.',
'Die Venus ist zwar weiter von der Sonne entfernt, hat aber höhere Temperaturen als Merkur.',
'Venus dreht sich entgegen dem Uhrzeigersinn, möglicherweise aufgrund eines früheren Zusammenstoßes mit einem Asteroiden.',
'Auf dem Mars erscheint die Sonne nur halb so groß wie auf der Erde.',
'Die Erde ist der einzige Planet, der nicht nach einem Gott benannt ist.',
'Jupiter hat den kürzesten Tag aller Planeten.',
'Die Milchstraßengalaxis wird in etwa 5 Milliarden Jahren mit der Andromeda-Galaxis zusammenstoßen.',
'Die Sonne macht rund 99,86 % der Masse im Sonnensystem aus.',
'Die Sonne ist eine fast perfekte Kugel.',
'Eine Sonnenfinsternis kann alle ein bis zwei Jahre eintreten. Sie ist daher ein seltenes Ereignis.',
'Der Saturn strahlt zweieinhalb mal mehr Energie in den Weltraum aus als er von der Sonne erhält.',
'Die Temperatur in der Sonne kann 15 Millionen Grad Celsius erreichen.',
'Der Mond entfernt sich von unserem Planeten etwa 3,8 cm pro Jahr.',
],
SKILL_NAME: 'Weltraumwissen auf Deutsch',
GET_FACT_MESSAGE: 'Hier sind deine Fakten: ',
HELP_MESSAGE: 'Du kannst sagen, „Nenne mir einen Fakt über den Weltraum“, oder du kannst „Beenden“ sagen... Wie kann ich dir helfen?',
HELP_REPROMPT: 'Wie kann ich dir helfen?',
STOP_MESSAGE: 'Auf Wiedersehen!',
},
},
};

const handlers = {
'LaunchRequest': function () {
this.emit('GetFact');
},
'GetNewFactIntent': function () {
this.emit('GetFact');
},
'GetFact': function () {
// Get a random space fact from the space facts list
// Use this.t() to get corresponding language data
const factArr = this.t('FACTS');
const factIndex = Math.floor(Math.random() * factArr.length);
const randomFact = factArr[factIndex];

// Create speech output
const speechOutput = this.t('GET_FACT_MESSAGE') + randomFact;
this.emit(':tellWithCard', speechOutput, this.t('SKILL_NAME'), randomFact);
},
'AMAZON.HelpIntent': function () {
const speechOutput = this.t('HELP_MESSAGE');
const reprompt = this.t('HELP_MESSAGE');
this.emit(':ask', speechOutput, reprompt);
},
'AMAZON.CancelIntent': function () {
this.emit(':tell', this.t('STOP_MESSAGE'));
},
'AMAZON.StopIntent': function () {
this.emit(':tell', this.t('STOP_MESSAGE'));
},
};

exports.handler = function (event, context) {
const alexa = Alexa.handler(event, context);
alexa.APP_ID = APP_ID;
// To enable string internationalization (i18n) features, set a resources object.
alexa.resources = languageStrings;
alexa.registerHandlers(handlers);
alexa.execute();
};
Gruß
CmdKeen
0 x
Antworten

Zurück zu „Fähigkeiten (Skills) entwickeln“

  • Information