I've been stuck with hosting an alexa skill webserver on my localhost! Everything's correct from the Intents I've made, the url works, and it does request the intent I ask it for, but Alexa constantly keeps saying "There was a problem with the requested skill's response"
const express = require("express");
const Alexa = require('ask-sdk-core');
const { ExpressAdapter } = require("ask-sdk-express-adapter");
const app = express();
const LaunchRequestHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'LaunchRequest';
},
handle(handlerInput) {
const speechText = 'Hello World - Your skill has launched';
return handlerInput.responseBuilder
.speak(speechText)
.reprompt(speechText)
.withSimpleCard('Hello World', speechText)
.getResponse();
}
};
const builder = Alexa.SkillBuilders.custom();
builder.addRequestHandlers(
LaunchRequestHandler
);
const skill = builder.create();
const adapter = new ExpressAdapter(skill, false, false);
app.post('/', adapter.getRequestHandlers());
app.listen(443, null, () => {
console.log("App is now online!");
});
This is the json body it gives when it tries to send a post / first
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.325e7e93-3033-4e26-ada6-45f7967971bf",
"application": {
"applicationId": "amzn1.ask.skill.c1ed78ba-9003-4904-9376-b9a05b3a4bcc"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AH7FLOU7DBFRWVIENTV7VT7EMQLPAGYMFU4YUTI6OSBCK6GOKXWNQ6BI3BPZPEMN2TQFXGZCO43KXB3HJNVJPBJILPEDLGIAMQK2DK3C42S5FBPCQSN6B46FMQDATFSCL42YCF25PR5CFPGHYUFIDIJHZAJRIGMZ5BGZMU7FNJB4I6KBVDF5N2WIXCIG6YMV2X4ZO3QETGA23HQ"
}
},
"context": {
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 213,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"mode": "HUB",
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1280,
"pixelHeight": 800
}
}
}
}
],
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 346,
"arcMinuteHeight": 216,
"canRotate": false,
"canResize": false
}
],
"mode": "HUB",
"shape": "RECTANGLE",
"pixelWidth": 1280,
"pixelHeight": 800,
"dpi": 213,
"currentPixelWidth": 1280,
"currentPixelHeight": 800,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Extensions": {
"available": {
"aplext:backstack:10": {}
}
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.c1ed78ba-9003-4904-9376-b9a05b3a4bcc"
},
"user": {
"userId": "amzn1.ask.account.AH7FLOU7DBFRWVIENTV7VT7EMQLPAGYMFU4YUTI6OSBCK6GOKXWNQ6BI3BPZPEMN2TQFXGZCO43KXB3HJNVJPBJILPEDLGIAMQK2DK3C42S5FBPCQSN6B46FMQDATFSCL42YCF25PR5CFPGHYUFIDIJHZAJRIGMZ5BGZMU7FNJB4I6KBVDF5N2WIXCIG6YMV2X4ZO3QETGA23HQ"
},
"device": {
"deviceId": "amzn1.ask.device.AGZ65ZMWRSISWS4RB63ZEBKJDJPMICI5WU6SDYTU7CZKDFASRAAR7WNYRTVKYWRURCC77E2EIGXBBUTO3REKDGWMLJDN7ODAHKWJLJCTNHN3CU3LVXDMGRJJ3HIXMWRLVT6D5OFWNYXZ73J7Y6TCONRXYL2OTJHRQ7SUGQKEBBIPNVIYZ35WI",
"supportedInterfaces": {}
},
"apiEndpoint": "https://api.amazonalexa.com",
"apiAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ.eyJhdWQiOiJodHRwczovL2FwaS5hbWF6b25hbGV4YS5jb20iLCJpc3MiOiJBbGV4YVNraWxsS2l0Iiwic3ViIjoiYW16bjEuYXNrLnNraWxsLmMxZWQ3OGJhLTkwMDMtNDkwNC05Mzc2LWI5YTA1YjNhNGJjYyIsImV4cCI6MTYzODQ5ODQ3OCwiaWF0IjoxNjM4NDk4MTc4LCJuYmYiOjE2Mzg0OTgxNzgsInByaXZhdGVDbGFpbXMiOns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BCSklMUEVETEdJQU1RSzJESzNDNDJTNUZCUENRU042QjQ2Rk1RREFURlNDTDQyWUNGMjVQUjVDRlBHSFlVRklESUpIWkFKUklHTVo1QkdaTVU3Rk5KQjRJNktCVkRGNU4yV0lYQ0lHNllNVjJYNFpPM1FFVEdBMjNIUSJ9fQ.X2fY3XTWW8zRZtwE6km2AIaSnhaAfSLKYqzgwlZrui6OyCS03Lfh1dJWHg4sZxTZqWyssV7VFWErW-gTZFUdkagtbbknuZQ3qlVQlwpZPaKhKBYC9VBDfmnGtjjDDCAAUyvB8ZIInbuxsrZ6DwYtuj5sa5_wGSfc0s2THQqP9Azklgk5UobwMN0iWsrhDSXy4guB4KaEJscD8_OLr2ZnbvWqy3tAPv3zfEsb8OmnOC7FBMHHgN-aCIRubnZNu8YA2Xtf-usOn1wVAjaIwEdlfgrOCRfFpZc3l7tfHTfX9HfLerRFh_IWQWc61DVfQZhyH4yeH5fdKUVDMels4zXlKQ"
}
},
"request": {
"type": "SessionEndedRequest",
"requestId": "amzn1.echo-api.request.e6d2bca6-4680-4367-8bb1-104e038c35ba",
"timestamp": "2021-12-03T02:22:58Z",
"locale": "en-US",
"reason": "ERROR",
"error": {
"type": "INVALID_RESPONSE",
"message": "An exception occurred while dispatching the request to the skill."
}
}
}
And the 2nd json body post / request when it errors:
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.325e7e93-3033-4e26-ada6-45f7967971bf",
"application": {
"applicationId": "amzn1.ask.skill.c1ed78ba-9003-4904-9376-b9a05b3a4bcc"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AH7FLOU7DBFRWVIENTV7VT7EMQLPAGYMFU4YUTI6OSBCK6GOKXWNQ6BI3BPZPEMN2TQFXGZCO43KXB3HJNVJPBJILPEDLGIAMQK2DK3C42S5FBPCQSN6B46FMQDATFSCL42YCF25PR5CFPGHYUFIDIJHZAJRIGMZ5BGZMU7FNJB4I6KBVDF5N2WIXCIG6YMV2X4ZO3QETGA23HQ"
}
},
"context": {
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 213,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"mode": "HUB",
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1280,
"pixelHeight": 800
}
}
}
}
],
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 346,
"arcMinuteHeight": 216,
"canRotate": false,
"canResize": false
}
],
"mode": "HUB",
"shape": "RECTANGLE",
"pixelWidth": 1280,
"pixelHeight": 800,
"dpi": 213,
"currentPixelWidth": 1280,
"currentPixelHeight": 800,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Extensions": {
"available": {
"aplext:backstack:10": {}
}
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.c1ed78ba-9003-4904-9376-b9a05b3a4bcc"
},
"user": {
"userId": "amzn1.ask.account.AH7FLOU7DBFRWVIENTV7VT7EMQLPAGYMFU4YUTI6OSBCK6GOKXWNQ6BI3BPZPEMN2TQFXGZCO43KXB3HJNVJPBJILPEDLGIAMQK2DK3C42S5FBPCQSN6B46FMQDATFSCL42YCF25PR5CFPGHYUFIDIJHZAJRIGMZ5BGZMU7FNJB4I6KBVDF5N2WIXCIG6YMV2X4ZO3QETGA23HQ"
},
"device": {
"deviceId": "amzn1.ask.device.AGZ65ZMWRSISWS4RB63ZEBKJDJPMICI5WU6SDYTU7CZKDFASRAAR7WNYRTVKYWRURCC77E2EIGXBBUTO3REKDGWMLJDN7ODAHKWJLJCTNHN3CU3LVXDMGRJJ3HIXMWRLVT6D5OFWNYXZ73J7Y6TCONRXYL2OTJHRQ7SUGQKEBBIPNVIYZ35WI",
"supportedInterfaces": {}
},
"apiEndpoint": "https://api.amazonalexa.com",
"apiAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ.eyJhdWQiOiJodH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UkpKM0hJWE1XUkxWVDZENU9GV05ZWFo3M0o3WTZUQ09OUlhZTDJPVEpIUlE3U1VHUUtFQkJJUE5WSVlaMzVXSSIsInVzZXJJZCI6ImFtem4xLmFzay5hY2NvdW50LkFIN0ZMT1U3REJGUldWSUVOVFY3VlQ3RU1RTFBBR1lNRlU0WVVUSTZPU0JDSzZHT0tYV05RNkJJM0JQWlBFTU4yVFFGWEdaQ080M0tYQjNISk5WSlBCSklMUEVETEdJQU1RSzJESzNDNDJTNUZCUENRU042QjQ2Rk1RREFURlNDTDQyWUNGMjVQUjVDRlBHSFlVRklESUpIWkFKUklHTVo1QkdaTVU3Rk5KQjRJNktCVkRGNU4yV0lYQ0lHNllNVjJYNFpPM1FFVEdBMjNIUSJ9fQ.X2fY3XTWW8zRZtwE6km2AIaSnhaAfSLKYqzgwlZrui6OyCS03Lfh1dJWHg4sZxTZqWyssV7VFWErW-gTZFUdkagtbbknuZQ3qlVQlwpZPaKhKBYC9VBDfmnGtjjDDCAAUyvB8ZIInbuxsrZ6DwYtuj5sa5_wGSfc0s2THQqP9Azklgk5UobwMN0iWsrhDSXy4guB4KaEJscD8_OLr2ZnbvWqy3tAPv3zfEsb8OmnOC7FBMHHgN-aCIRubnZNu8YA2Xtf-usOn1wVAjaIwEdlfgrOCRfFpZc3l7tfHTfX9HfLerRFh_IWQWc61DVfQZhyH4yeH5fdKUVDMels4zXlKQ"
}
},
"request": {
"type": "SessionEndedRequest",
"requestId": "amzn1.echo-api.request.e6d2bca6-4680-4367-8bb1-104e038c35ba",
"timestamp": "2021-12-03T02:22:58Z",
"locale": "en-US",
"reason": "ERROR",
"error": {
"type": "INVALID_RESPONSE",
"message": "An exception occurred while dispatching the request to the skill."
}
}
}
Here is my current code, hopefully someone can help me
After hours of researching and github searches, this is the github repo you need to look at if you are willing to host your skill locally using REST API