Hi,
I created an Alexa Skill using Jovo 2.2. It worked well in the development environment, so I wanted to deploy it to a server (I’m using a windows server vm). Which worked fine as well, until I tried to verify the requests from alexa. I tried following the instructions at https://www.jovo.tech/docs/hosting/express-js .
But then I get the following errors:
Error -----------------------------------------------------------
Message:
Unexpected token u in JSON at position 0
Stack:
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse ()
at BasicLogging.requestLogger (C:\USU\voice-server\node_modul
work\src\middleware\logging\BasicLogging.ts:82:30)
at App.emit (events.js:198:13)
at Middleware.run (C:\USU\voice-server\node_modules\jovo-core
re.ts:91:19)
at App.handle (C:\USU\voice-server\node_modules\jovo-core\src
07:41)
at App.handle (C:\USU\voice-server\node_modules\jovo-framewor
413:17)
at Webhook.post (C:\USU\voice-server\index.js:28:14)
at Layer.handle [as handle_request] (C:\USU\voice-server\node
ess\lib\router\layer.js:95:5)
at next (C:\USU\voice-server\node_modules\express\lib\router
13)
at Route.dispatch (C:\USU\voice-server\node_modules\express\l
te.js:112:3)
WARN: Jovo instance is not available. ON_ERROR doesn’t work here
and:
Error -----------------------------------------------------------
Message:
Unexpected token u in JSON at position 0
Stack:
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse ()
at BasicLogging.requestLogger (C:\USU\voice-server\node_modul
work\src\middleware\logging\BasicLogging.ts:82:30)
at App.emit (events.js:198:13)
at Middleware.run (C:\USU\voice-server\node_modules\jovo-core
re.ts:91:19)
at App.handle (C:\USU\voice-server\node_modules\jovo-core\src
07:41)
at App.handle (C:\USU\voice-server\node_modules\jovo-framewor
413:17)
at Webhook.post (C:\USU\voice-server\index.js:28:14)
at Layer.handle [as handle_request] (C:\USU\voice-server\node
ess\lib\router\layer.js:95:5)
at next (C:\USU\voice-server\node_modules\express\lib\router
13)
at Route.dispatch (C:\USU\voice-server\node_modules\express\l
te.js:112:3)
WARN: Jovo instance is not available. ON_ERROR doesn’t work here
This happens only when I include the alexa-verifier-middleware. But to certify the skill I need the requests to be verified, if I understood that correctly.
My index.js looks like this:
‘use strict’;
const { WebhookVerified: Webhook, ExpressJS, Lambda } = require(‘jovo-framework’);
const { app } = require (’./app.js’);
// ------------------------------------------------------------------
// HOST CONFIGURATION
// ------------------------------------------------------------------
// ExpressJS (Jovo Webhook)
if (process.argv.indexOf(’–webhook’) > -1) {
const port = process.env.JOVO_PORT || 3001;
Webhook.jovoApp = app;
Webhook.listen(port, () => {
console.info(`Local server listening on port ${port}.`);
});
Webhook.post('/alexa', async (req, res) => {
await app.handle(new ExpressJS(req, res));
});
}
// AWS Lambda
exports.handler = async (event, context, callback) => {
await app.handle(new Lambda(event, context, callback));
};
And I’m starting the app by calling:
node index.js --webhook
I tried including the alexa-verifier-middleware in the way described on the npm page (https://www.npmjs.com/package/alexa-verifier-middleware), but that didn’t work either. I didn’t get any errors anymore, but I also didn’t get any response from the app back to alexa.
I’m lost here, any idea what I can try or do?