Ошибка Heroku, я не понял, связана ли эта ошибка с пакетами npm или с таймаутом - PullRequest
0 голосов
/ 23 марта 2019

Я пытаюсь развернуть свое экспресс-приложение на Heroku, но оно каждый раз вылетает со следующими журналами: -

2019-03-22T19:26:26.149208+00:00 heroku[web.1]: State changed from starting to crashed
2019-03-22T19:26:26.122569+00:00 heroku[web.1]: Process exited with status 1
2019-03-22T19:26:25.977206+00:00 app[web.1]:
2019-03-22T19:26:25.977226+00:00 app[web.1]: > Server@1.0.0 start /app
2019-03-22T19:26:25.977228+00:00 app[web.1]: > node server.js
2019-03-22T19:26:25.977229+00:00 app[web.1]:
2019-03-22T19:26:26.059671+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-03-22T19:26:26.059674+00:00 app[web.1]: throw err;
2019-03-22T19:26:26.059676+00:00 app[web.1]: ^
2019-03-22T19:26:26.059678+00:00 app[web.1]:
2019-03-22T19:26:26.059680+00:00 app[web.1]: Error: Cannot find module '/app/server.js'
2019-03-22T19:26:26.059682+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-03-22T19:26:26.059683+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-03-22T19:26:26.059685+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-03-22T19:26:26.059687+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-03-22T19:26:26.059689+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-03-22T19:26:26.065404+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-03-22T19:26:26.065766+00:00 app[web.1]: npm ERR! errno 1
2019-03-22T19:26:26.066805+00:00 app[web.1]: npm ERR! Server@1.0.0 start: `node server.js`
2019-03-22T19:26:26.066916+00:00 app[web.1]: npm ERR! Exit status 1
2019-03-22T19:26:26.067117+00:00 app[web.1]: npm ERR!
2019-03-22T19:26:26.067233+00:00 app[web.1]: npm ERR! Failed at the Server@1.0.0 start script.
2019-03-22T19:26:26.067395+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-03-22T19:26:26.071997+00:00 app[web.1]:
2019-03-22T19:26:26.072138+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-03-22T19:26:26.072224+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2019-03-22T19_26_26_068Z-debug.log
2019-03-22T19:27:18.000000+00:00 app[api]: Build started by user ab98647@gmail.com
2019-03-22T19:27:32.768091+00:00 heroku[web.1]: State changed from crashed to starting
2019-03-22T19:27:34.827273+00:00 heroku[web.1]: Starting process with command `npm start`
2019-03-22T19:27:32.578293+00:00 app[api]: Release v13 created by user ab98647@gmail.com
2019-03-22T19:27:32.578293+00:00 app[api]: Deploy 7e0d91c1 by user ab98647@gmail.com
2019-03-22T19:27:33.000000+00:00 app[api]: Build succeeded
2019-03-22T19:27:36.739160+00:00 app[web.1]:
2019-03-22T19:27:36.739182+00:00 app[web.1]: > Server@1.0.0 start /app
2019-03-22T19:27:36.739184+00:00 app[web.1]: > node server.js
2019-03-22T19:27:36.739185+00:00 app[web.1]:
2019-03-22T19:27:37.087619+00:00 app[web.1]: App is working
2019-03-22T19:27:37.617321+00:00 heroku[web.1]: State changed from starting to up
2019-03-22T19:30:44.261549+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=secret-beach-23042.herokuapp.com request_id=3a765852-d9f6-492b-869e-8e6f6f57cdf7 fwd="47.247.184.33" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2019-03-22T19:31:23.585873+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=secret-beach-23042.herokuapp.com request_id=3c116fc4-4d3f-4b55-ad9f-97942e9e9e99 fwd="47.247.184.33" dyno=web.1 connect=1ms service=30003ms status=503 bytes=0 protocol=https
2019-03-22T19:38:19.581701+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=secret-beach-23042.herokuapp.com request_id=3a9756f6-0c75-419e-9724-b76da81b853b fwd="47.247.184.33" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2019-03-22T20:01:13.086387+00:00 heroku[web.1]: Idling
2019-03-22T20:01:13.091324+00:00 heroku[web.1]: State changed from up to down
2019-03-22T20:01:14.577272+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-03-22T20:01:14.691025+00:00 heroku[web.1]: Process exited with status 143
2019-03-22T20:41:21.048924+00:00 heroku[web.1]: State changed from down to starting
2019-03-22T20:41:23.311286+00:00 heroku[web.1]: Starting process with command `npm start`
2019-03-22T20:41:25.122476+00:00 app[web.1]:
2019-03-22T20:41:25.122494+00:00 app[web.1]: > Server@1.0.0 start /app
2019-03-22T20:41:25.122496+00:00 app[web.1]: > node server.js
2019-03-22T20:41:25.122498+00:00 app[web.1]:
2019-03-22T20:41:25.655023+00:00 heroku[web.1]: State changed from starting to up
2019-03-22T20:41:25.452310+00:00 app[web.1]: App is working
2019-03-22T20:46:58.094883+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=secret-beach-23042.herokuapp.com request_id=592a14a7-b683-4f5a-9593-ed0eca3d1c7e fwd="47.247.184.33" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2019-03-22T20:50:12.000000+00:00 app[api]: Build started by user ab98647@gmail.com
2019-03-22T20:50:27.551012+00:00 app[api]: Deploy 58e9e00f by user ab98647@gmail.com
2019-03-22T20:50:27.551012+00:00 app[api]: Release v14 created by user ab98647@gmail.com
2019-03-22T20:50:28.000000+00:00 app[api]: Build succeeded
2019-03-22T20:50:31.597374+00:00 heroku[web.1]: Restarting
2019-03-22T20:50:31.619924+00:00 heroku[web.1]: State changed from up to starting
2019-03-22T20:50:32.995500+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-03-22T20:50:32.995500+00:00 heroku[web.1]: Process exited with status 143
2019-03-22T20:50:34.030210+00:00 heroku[web.1]: Starting process with command `npm start`
2019-03-22T20:50:37.589947+00:00 app[web.1]:
2019-03-22T20:50:37.589988+00:00 app[web.1]: > Server@1.0.0 start /app
2019-03-22T20:50:37.589990+00:00 app[web.1]: > node server.js
2019-03-22T20:50:37.589992+00:00 app[web.1]:
2019-03-22T20:50:38.620173+00:00 heroku[web.1]: State changed from starting to up
2019-03-22T20:50:38.544170+00:00 app[web.1]: App is working
2019-03-22T20:56:30.000000+00:00 app[api]: Build started by user ab98647@gmail.com
2019-03-22T20:56:45.960310+00:00 heroku[web.1]: Restarting
2019-03-22T20:56:45.978197+00:00 heroku[web.1]: State changed from up to starting
2019-03-22T20:56:45.647303+00:00 app[api]: Release v15 created by user ab98647@gmail.com
2019-03-22T20:56:45.647303+00:00 app[api]: Deploy f2758b5c by user ab98647@gmail.com
2019-03-22T20:56:46.000000+00:00 app[api]: Build succeeded
2019-03-22T20:56:47.541219+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-03-22T20:56:47.659446+00:00 heroku[web.1]: Process exited with status 143
2019-03-22T20:56:48.601100+00:00 heroku[web.1]: Starting process with command `npm start`
2019-03-22T20:56:50.396013+00:00 app[web.1]:
2019-03-22T20:56:50.396063+00:00 app[web.1]: > Server@1.0.0 start /app
2019-03-22T20:56:50.396065+00:00 app[web.1]: > node server.js
2019-03-22T20:56:50.396067+00:00 app[web.1]:
2019-03-22T20:56:50.845287+00:00 heroku[web.1]: State changed from starting to up
2019-03-22T20:56:50.782758+00:00 app[web.1]: App is working
2019-03-22T21:31:11.982402+00:00 heroku[web.1]: Idling
2019-03-22T21:31:11.992917+00:00 heroku[web.1]: State changed from up to down
2019-03-22T21:31:12.708220+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-03-22T21:31:12.769110+00:00 heroku[web.1]: Process exited with status 143
2019-03-23T06:27:23.000000+00:00 app[api]: Build started by user ab98647@gmail.com
2019-03-23T06:27:39.496098+00:00 app[api]: Release v16 created by user ab98647@gmail.com
2019-03-23T06:27:39.496098+00:00 app[api]: Deploy fbae53e0 by user ab98647@gmail.com
2019-03-23T06:27:40.388432+00:00 heroku[web.1]: State changed from down to starting
2019-03-23T06:27:43.640584+00:00 heroku[web.1]: Starting process with command `npm start`
2019-03-23T06:27:40.000000+00:00 app[api]: Build succeeded
2019-03-23T06:27:46.450974+00:00 app[web.1]:
2019-03-23T06:27:46.450990+00:00 app[web.1]: > Server@1.0.0 start /app
2019-03-23T06:27:46.450992+00:00 app[web.1]: > node server.js
2019-03-23T06:27:46.450994+00:00 app[web.1]:
2019-03-23T06:27:46.969621+00:00 app[web.1]: App is working
2019-03-23T06:27:47.560758+00:00 heroku[web.1]: State changed from starting to up

Здесь, даже после того, как сборка завершилась неудачей, приложение так и вышло, и я не могу понять ошибку, например, связана ли она с npm, тайм-аутом или чем-то еще? Procfile содержит: web: узел server.js

Вот мой файл package.json


{
  "name": "Server",
  "version": "1.0.0",
  "main": "server.js",
  "dependencies": {
    "bcrypt-nodejs": "0.0.3",
    "body-parser": "^1.18.3",
    "cors": "^2.8.5",
    "express": "^4.16.4",
    "knex": "^0.16.3",
    "mysql": "^2.16.0"
  },
  "devDependencies": {
    "nodemon": "^1.18.9"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "repository": {
    "type": "git",
    "url": "https://github.com/ankit986/Brainly-React-Project/tree/master/Backend/Backend/Server"
  },
  "description": ""
}


и файл server.js: -

const express = require('express');
const bodyParser = require('body-parser');
const bcrypt = require('bcrypt-nodejs');
const cors = require('cors');
const knex = require('knex')


const mysql = knex({
  client: 'mysql',
  connection: {
    host : '127.0.0.1',
    user : 'root',
    password : 'Amit',
    database : 'brainly'
  }
});

const app = express();

const Signin = require('./SigninServer.js');
const Register = require('./RegisterServer.js');
const Profile = require('./ProfileServer.js');
const Image = require('./ImageServer.js');

app.use(bodyParser.json());
app.use(cors());

app.get('/',(req, res) => {
    res.send("working");
})

app.post('/signin', (req, res) => {Signin.handleSignin(req, res, mysql, bcrypt)})
app.post('/register', (req, res) => {Register.handleRegister(req, res, mysql, bcrypt)})
app.get('/profile/:id',(req, res) => {Profile.handleProfile(req, res, mysql, bcrypt)})
app.put('/image', (req, res) => {Image.handleImage(req, res, mysql, bcrypt)})

app.listen(process.env.PORT || 3000, ()=>{
    console.log("App is working");
}) ;

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...