前提・実現したいこと
Vue.jsのアプリケーションでアンケートページを作成しています。
Herokuで公開したいのですが、エラーが発生してしまい、どうすればいいのかわからないため、ご質問させていただきました。
Herokuは今まで使用したことがなく、初心者です・・・。
発生している問題・エラーメッセージ
ターミナル
$heroku logs 2020-10-16T05:16:26.250396+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=f8757943-4bbb-4bcb-b4f4-04097554cf67 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:16:26.694044+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=a286e16b-c8de-40cb-8dff-4bac060cec0d fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:16:27.306124+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-hollows-34215.herokuapp.com request_id=c33de659-64fc-4884-b7ef-8fb3e7bbcc7a fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:17:55.300171+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=09845468-033e-4bb6-8ec1-56bcbdff0f53 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:17:55.761658+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=e585c9d7-1cbc-4d8e-810c-d668158bf675 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:17:56.302157+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-hollows-34215.herokuapp.com request_id=824e3327-b6de-4f4b-9695-84b85ad505c1 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:22:24.422451+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=38377d9a-6501-4c71-8fe9-bc304d54b765 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:22:24.872156+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-hollows-34215.herokuapp.com request_id=68e429fd-2099-41f0-b92a-5a04fc7fe816 fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https 2020-10-16T05:22:25.442975+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-hollows-34215.herokuapp.com request_id=17f6c7f7-84d6-4f47-aa85-a9ee9929851f fwd="60.117.133.203" dyno= connect= service= status=503 bytes= protocol=https
Heroku Activityログ
-----> Node.js app detected -----> Creating runtime environment NPM_CONFIG_LOGLEVEL=error NODE_ENV=production NODE_MODULES_CACHE=true NODE_VERBOSE=false -----> Installing binaries engines.node (package.json): unspecified engines.npm (package.json): unspecified (use default) Resolving node version 12.x... Downloading and installing node 12.19.0... Using default npm version: 6.14.8 -----> Installing dependencies Installing node modules (package.json) up to date in 0.223s found 0 vulnerabilities -----> Build -----> Caching build - node_modules (nothing to cache) -----> Pruning devDependencies up to date in 0.23s found 0 vulnerabilities -----> Build succeeded! ! This app may not specify any way to start a node process https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type -----> Discovering process types Procfile declares types -> (none) Default types for buildpack -> web -----> Compressing... Done: 22.4M -----> Launching... Released v6 https://intense-hollows-34215.herokuapp.com/ deployed to Heroku
該当のソースコード
package.json
"scripts": { "start": "node dist/index.js", "build": "run-s build:*", "build:backend": "tsc", "build:front": "webpack --config webpack.front.config.js --mode production", "watch": "run-p watch:*", "watch:front": "webpack --config webpack.front.config.js --watch --mode development", "watch:backend": "tsc-watch --onSuccess \"node dist/index.js\"", "test": "echo \"Error: no test specified\" && exit 1" },
src/backend/index.tx
import express from 'express' import messageController from './controllers/message' import enqueteController from './controllers/enquete' import loginController from './controllers/login' import { createConnection } from 'typeorm' import Enquete from './models/Enquete' const app: express.Express = express() app.use(express.json()) app.use(express.urlencoded({ extended: true })) app.use("/messages", messageController) app.use("/api/enquetes", enqueteController) app.use("/api/login", loginController) app.use("/", express.static(__dirname + "/public")) app.get('*', (req, res) => { res.status(200).sendFile(__dirname + "/public/index.html"); }); !async function initialize() { await createConnection({ type: "postgres", url: process.env.DATABASE_URL || "postgres://postgres:postgres@localhost:5432/postgres", synchronize: true, entities: [ Enquete, ], extra: { ssl: (!!process.env.DATABASE_SSL) ? { rejectUnauthorized: false, } : false, } }); const port = process.env.PORT || 3000; app.listen(port, () => { console.log("ポート" + port + "番で起動しました〜!") }) }()
試したこと
「HerokuでNode.jsアプリケーションを公開する」(https://pragmatic.ukiuni.com/type_deploy_heroku/)
この記事を参照して作成していました。
よろしくお願い致します。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。