Deploy on own server is not working

amazon-alexa
deployment

#1

Following your guide I’m trying to deploy an Alexa Skill to my own server.

const { WebhookVerified: Webhook, ExpressJS } = require('jovo-framework');
const { app } = require('./app.js');

if (process.argv.indexOf('--webhook') > -1) {
  const port = process.env.JOVO_PORT || 80;
  Webhook.jovoApp = app;

  Webhook.listen(port, () => {
    console.info(`Local server listening on port ${port}.`);
  });

  Webhook.post(['/webhook','/webhook_alexa'], async (req, res) => {
    await app.handle(new ExpressJS(req, res));
  });

  const fs = require('fs');

        
  Webhook.ssl = {
          key: fs.readFileSync('/etc/letsencrypt/live/mydomain/privkey.pem'),
         cert: fs.readFileSync('/etc/letsencrypt/live/mydomain/fullchain.pem'),
  };
}


// AWS Lambda
exports.handler = async (event, context, callback) => {
  await app.handle(new Lambda(event, context, callback));
};

This is my index.js, I had done the “node index.js -webhook” but the server is only getting the HTTP request and note the HTTPS. Why is this happening?

Trying with a custom project.js that enable HTTP and HTTPS everything works, so the problem is not with the certificate.


#2

Could you try to change the port to 443?


#3

I have tried, it only points to the HTTP even if I ask for HTTPS, is there something I can try to add to the code? Or what could it be the problem?


#4

The problem was that this part here, must stay above the Webhook.listen, after that, I used the 443 port.

I suggest changing the order in the tutorial about deploying on own server (this)