PERN Project - Heroku Application Error - Help pleeeeeeeease!

Hello everyone,

I have managed to put together a PERN weather app portfolio, and on loading to heroku it does not connect and says application error. on loading the error on terminal, this is what came out, I do not have a clue as to what to do, I have tried many times deleting and starting all over but same issue. I appreciate every help to fix this: below are the codes and heroku log tails

const path = require(‘path’);

const express = require(‘express’);

const bodyParser = require(‘body-parser’);

var db = require(’./database’);

const ENV = process.env.NODE_ENV;

const PORT = process.env.PORT || 5000;

const app = express();

app.use(express.json());

app.use(express.urlencoded({extended: false}));

app.use(bodyParser.json());

app.use(’/api/cities’, require(’./api/cities’));

app.use(’/api/weather’, require(’./api/weather’));

if (ENV === ‘production’) {

app.use(express.static(path.join(__dirname, '../client/build')));

app.use((req, res) => {

  res.sendFile(path.join(__dirname, '../client/build/index.html'));

});

}

app.listen(PORT, () => {

console.log(`server listening on port ${PORT}!.`);

});

db.query(‘SELECT NOW()’, (err, res) => {

if (err.error)

  return console.log(err.error);

console.log(`PostgreSQL connected: ${res[0].now}.`);

});

module.exports = app;

$ heroku logs --tail
2021-08-16T16:32:28.647129+00:00 app[api]: Initial release by user mfonchris273@yahoo.com
2021-08-16T16:32:28.647129+00:00 app[api]: Release v1 created by user mfonchris273@yahoo.com
2021-08-16T16:32:28.793198+00:00 app[api]: Release v2 created by user mfonchris273@yahoo.com
2021-08-16T16:32:28.793198+00:00 app[api]: Enable Logplex by user mfonchris273@yahoo.com
2021-08-16T16:36:00.896673+00:00 app[api]: Running release v3 commands by user mfonchris273@yahoo.com
2021-08-16T16:36:00.896673+00:00 app[api]: Attach DATABASE (@ref:myweatherapp-db) by user mfonchris273@yahoo.com
2021-08-16T16:36:00.911290+00:00 app[api]: Release v4 created by user mfonchris273@yahoo.com
2021-08-16T16:36:00.911290+00:00 app[api]: @ref:myweatherapp-db completed provisioning, setting DATABASE_URL. by user mfonchris273@yahoo.com
2021-08-16T16:40:39.900265+00:00 app[api]: Release v5 created by user mfonchris273@yahoo.com
2021-08-16T16:40:39.900265+00:00 app[api]: Attach HEROKU_POSTGRESQL_NAVY (@ref:myweatherapp-db) by user mfonchris273@yahoo.com
2021-08-16T16:55:03.000000+00:00 app[api]: Build started by user mfonchris273@yahoo.com
2021-08-16T16:56:52.043720+00:00 app[api]: Deploy bf2b1179 by user mfonchris273@yahoo.com
2021-08-16T16:56:52.043720+00:00 app[api]: Release v6 created by user mfonchris273@yahoo.com
2021-08-16T16:56:52.058178+00:00 app[api]: Scaled to web@1:Free by user mfonchris273@yahoo.com
2021-08-16T16:56:53.000000+00:00 app[api]: Build succeeded
2021-08-16T16:56:57.728573+00:00 heroku[web.1]: Starting process with command npm start
2021-08-16T16:56:59.700436+00:00 app[web.1]:
2021-08-16T16:56:59.700451+00:00 app[web.1]: > final-pern-portfolio@1.0.0 start /app
2021-08-16T16:56:59.700451+00:00 app[web.1]: > node server
2021-08-16T16:56:59.700452+00:00 app[web.1]:
2021-08-16T16:57:00.088051+00:00 app[web.1]: server listening on port 50242!.
2021-08-16T16:57:00.104545+00:00 heroku[web.1]: State changed from starting to up
2021-08-16T16:57:00.112078+00:00 app[web.1]: /app/server/database/index.js:23
2021-08-16T16:57:00.112080+00:00 app[web.1]: if (err) throw err;
2021-08-16T16:57:00.112080+00:00 app[web.1]: ^
2021-08-16T16:57:00.112080+00:00 app[web.1]:
2021-08-16T16:57:00.112081+00:00 app[web.1]: Error: self signed certificate
2021-08-16T16:57:00.112082+00:00 app[web.1]: at TLSSocket.onConnectSecure (_tls_wrap.js:1514:34)
2021-08-16T16:57:00.112082+00:00 app[web.1]: at TLSSocket.emit (events.js:400:28)
2021-08-16T16:57:00.112082+00:00 app[web.1]: at TLSSocket._finishInit (_tls_wrap.js:936:8)
2021-08-16T16:57:00.112082+00:00 app[web.1]: at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:708:12) {
2021-08-16T16:57:00.112083+00:00 app[web.1]: code: ‘DEPTH_ZERO_SELF_SIGNED_CERT’
2021-08-16T16:57:00.112083+00:00 app[web.1]: }
2021-08-16T16:57:00.119660+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-08-16T16:57:00.119857+00:00 app[web.1]: npm ERR! errno 1
2021-08-16T16:57:00.124179+00:00 app[web.1]: npm ERR! final-pern-portfolio@1.0.0 start: node server
2021-08-16T16:57:00.124233+00:00 app[web.1]: npm ERR! Exit status 1
2021-08-16T16:57:00.124301+00:00 app[web.1]: npm ERR!
2021-08-16T16:57:00.124347+00:00 app[web.1]: npm ERR! Failed at the final-pern-portfolio@1.0.0 start script.
2021-08-16T16:57:00.124398+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-08-16T16:57:00.130675+00:00 app[web.1]:
2021-08-16T16:57:00.130970+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-08-16T16:57:00.130970+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-08-16T16_57_00_124Z-debug.log
2021-08-16T16:57:00.182136+00:00 heroku[web.1]: Process exited with status 1
2021-08-16T16:57:00.346372+00:00 heroku[web.1]: State changed from up to crashed
2021-08-16T16:57:00.353768+00:00 heroku[web.1]: State changed from crashed to starting
2021-08-16T16:57:06.608737+00:00 heroku[web.1]: Starting process with command npm start
2021-08-16T16:57:08.747614+00:00 app[web.1]:
2021-08-16T16:57:08.747647+00:00 app[web.1]: > final-pern-portfolio@1.0.0 start /app
2021-08-16T16:57:08.747647+00:00 app[web.1]: > node server
2021-08-16T16:57:08.747647+00:00 app[web.1]:
2021-08-16T16:57:09.054277+00:00 app[web.1]: server listening on port 3572!.
2021-08-16T16:57:09.072454+00:00 app[web.1]: /app/server/database/index.js:23
2021-08-16T16:57:09.072458+00:00 app[web.1]: if (err) throw err;
2021-08-16T16:57:09.072458+00:00 app[web.1]: ^
2021-08-16T16:57:09.072459+00:00 app[web.1]:
2021-08-16T16:57:09.072459+00:00 app[web.1]: Error: self signed certificate
2021-08-16T16:57:09.072460+00:00 app[web.1]: at TLSSocket.onConnectSecure (_tls_wrap.js:1514:34)
2021-08-16T16:57:09.072460+00:00 app[web.1]: at TLSSocket.emit (events.js:400:28)
2021-08-16T16:57:09.072461+00:00 app[web.1]: at TLSSocket._finishInit (_tls_wrap.js:936:8)
2021-08-16T16:57:09.072461+00:00 app[web.1]: at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:708:12) {
2021-08-16T16:57:09.072461+00:00 app[web.1]: code: ‘DEPTH_ZERO_SELF_SIGNED_CERT’
2021-08-16T16:57:09.072461+00:00 app[web.1]: }
2021-08-16T16:57:09.087643+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-08-16T16:57:09.087644+00:00 app[web.1]: npm ERR! errno 1
2021-08-16T16:57:09.090606+00:00 app[web.1]: npm ERR! final-pern-portfolio@1.0.0 start: node server
2021-08-16T16:57:09.090672+00:00 app[web.1]: npm ERR! Exit status 1
2021-08-16T16:57:09.090757+00:00 app[web.1]: npm ERR!
2021-08-16T16:57:09.090822+00:00 app[web.1]: npm ERR! Failed at the final-pern-portfolio@1.0.0 start script.
2021-08-16T16:57:09.090876+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-08-16T16:57:09.094892+00:00 app[web.1]:
2021-08-16T16:57:09.095092+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-08-16T16:57:09.095093+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-08-16T16_57_09_091Z-debug.log
2021-08-16T16:57:09.143394+00:00 heroku[web.1]: Process exited with status 1
2021-08-16T16:57:09.187579+00:00 heroku[web.1]: State changed from starting to crashed
2021-08-16T17:00:04.847089+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=dweather4youall.herokuapp.com request_id=10123b6d-52b9-422e-b166-2cf8ba6c4298 fwd=“94.1.241.27” dyno= connect= service= status=503 bytes= protocol=https
2021-08-16T17:00:05.351053+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=dweather4youall.herokuapp.com request_id=a7451278-5667-43bb-adf0-6554a4e9430a fwd=“94.1.241.27” dyno= connect= service= status=503 bytes= protocol=https
2021-08-16T17:00:05.572077+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=dweather4youall.herokuapp.com request_id=e17ebb81-f63b-4d5e-a38c-3de344c0dbcb fwd=“35.185.241.102” dyno= connect= service= status=503 bytes= protocol=http

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