I'm trying to build a webproject that works fine on localhost locally, but doesn't work when I upload it to heroku. I've added a Procfile with the text:
web: npm start which correctly runs
node index.js as it's supposed to. However, when it gets to listening to a port, it recieves way to high numbers as the port number (in the range of 300.000 and up). Here's an example from last run:
RangeError [ERR_SOCKET_BAD_PORT]: options.port should be >= 0 and < 65536. Received 350251..
Here is my code for listening:
httpsServer = https.createServer(credentials, app) httpServer = http.createServer(app) const httpPort = process.env.PORT || 80; const httpsPort = process.env.PORT + 1 || 443; app.use(express.static(__dirname + '/.webpages/' + webpage + '/public')) httpsServer.listen(httpsPort, () => console.log('HTTPS server listening on port ' + httpsPort)) httpServer.listen(httpPort, () => console.log('HTTP server listening on port ' + httpPort))
Is this a known issue or am I doing something wrong?