Hi everbody, I 'm going through the certification process for an Alexa Skill. I receive the error above mentioned. My endpoint runs on an Heroku app, when an Alexa request is sent to that endpoint, it triggers an http request to a remote web service. I 've checked and have turned on SSL Certificate on heroku app but keep receiving this message. I got it that there's something related the signature of the request but don't understand how to fix this problem. Any suggestions? Thanks in advance
This is the code:
const options = {
hostname: ‘xx.xx.xx.xx’,
port: 8080,
path: '/path/to/service?searchText=',
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Cookie':'' }
};
var server = http.createServer(app);
var port = process.env.PORT || 3000; server.listen(port, function () {
console.log("Server is up and running on port 3000...");
});
alexaRouter.post('/callAVA', function (req, res) {
bot=req.query.ava; callAva(req,res); });
function callAva(req, resp){
let strRicerca='';
let data='';
let strOutput='';
let sessionId = req.body.session.sessionId; l
let request = req.body.request; //per slot
let boolEndSession=false;
if (req.body.request.type === 'LaunchRequest') { strRicerca='zzzstart'; }
else if (req.body.request.type === 'IntentRequest' && req.body.request.intent.name === 'AnyText') { strRicerca=utf8.encode(request.intent.slots.searchText.value);
strRicerca = querystring.escape(strRicerca); }
else if (req.body.request.type === 'IntentRequest' && req.body.request.intent.name === 'AMAZON.HelpIntent') { strRicerca='zzzhelp'; }
else if (req.body.request.type === 'IntentRequest' && req.body.request.intent.name === 'AMAZON.StopIntent') { strRicerca='zzzstop'; boolEndSession=true; }
else if (req.body.request.type === 'IntentRequest' && req.body.request.intent.name === 'AMAZON.CancelIntent') { strRicerca='zzzcancel'; }
else if (req.body.request.type === 'SessionEndedRequest') { strRicerca='zzzEndSession'; }
else if (req.body.request.intent.name === 'AMAZON.FallbackIntent') { strRicerca='zzzNoResponse'; } else if (req.body.request.intent.name === 'AMAZON.NavigateHomeIntent') { strRicerca='zzznavigatehome'; }
if(strRicerca) {
options.path+=strRicerca+'&user=&pwd=&ava='+bot; }
var ss=leggiSessione(__dirname +'/sessions/', sessionId); if (ss===''){ options.headers.Cookie='JSESSIONID='; }
else { options.headers.Cookie='JSESSIONID='+ss; }
var req1 = http.request(options, (res) => { if (res.headers["set-cookie"]){
var x = res.headers["set-cookie"].toString(); var arr=x.split(';') var y=arr[0].split('='); scriviSessione(__dirname+'/sessions/',sessionId, y[1]); } res.setEncoding('utf8'); res.on('data', (chunk) => { data += chunk; let c=JSON.parse(data); strOutput=c.output[0].output; strOutput=strOutput.replace(/(<\/p>|<p>|<b>|<\/b>|<br>|<\/br>|<strong>|<\/strong>|<div>|<\/div>|<ul>|<li>|<\/ul>|<\/li>| |)/gi, ''); resp.json({ "version": "1.0", "response": { "shouldEndSession": boolEndSession, "outputSpeech": { "type": "PlainText", "text": strOutput } } }); }); res.on('end', () => { options.path='/AVA/rest/searchService/search_2?searchText='; }); }); req1.on('error', (e) => { strOutput="si è verificato errore " + e.message; }); req1.write(postData); req1.end(); };