Problems with using SSL on node js server for viber bot

I have a web server with viber bot in it. But to use it I need SSL certificate, so I installed the certbot and made request for my domain Certbot said "congrats", and so I pasted the path for certs in server httpsOptions:

const https = require('https');
const port = 80;

// Viber will push messages sent to this URL. Web server should be internet-facing.
const webhookUrl = '';

const httpsOptions = {
key: fs.readFileSync('C:/Certbot/live/'),
cert: fs.readFileSync('C:/Certbot/live/'),
ca: fs.readFileSync('C:/Certbot/live/')

const server = https.createServer(httpsOptions, bot.middleware()).listen(port, () => bot.setWebhook(webhookUrl))

But after running the server I'm only getting a lot of node exceptions:

[nodemon] starting node viber_bot.js
(node:3132) UnhandledPromiseRejectionWarning: #
(Use node --trace-warnings ... to show where the warning was created)
(node:3132) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see Command-line options | Node.js v15.11.0 Documentation). (rejection id: 1)
(node:3132) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

In other hand, whem I'm using ngrok for SSL, there is no problem.

What I'm doing wrong, and what I need to do?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.