Я развернул приложение в героку, и все было в порядке, пока я не попытался его открыть, и вот что мне выдает ошибка в CLI героку
2020-12-11T20:18:44.387993+00:00 app[api]: Release v1 created by user [email protected]
2020-12-11T20:18:44.387993+00:00 app[api]: Initial release by user [email protected]
2020-12-11T20:18:44.616103+00:00 app[api]: Release v2 created by user [email protected]
2020-12-11T20:18:44.616103+00:00 app[api]: Enable Logplex by user [email protected]
2020-12-11T20:19:57.566702+00:00 heroku[router]: at=info code=H81 desc = "Blank app" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=2a241f79-3efe-4109-8a98-8300267df8e8 fwd = "181.44.129.76" dyno= connect= service= status=502 bytes= protocol=https
2020-12-11T20:20:00.092425+00:00 heroku[router]: at=info code=H81 desc = "Blank app" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=647ef85e-7efc-4d09-8354-751d1e28522b fwd = "181.44.129.76" dyno= connect= service= status=502 bytes= protocol=https
2020-12-11T20:22:31.000000+00:00 app[api]: Build started by user [email protected]
2020-12-11T20:24:01.868276+00:00 app[api]: Release v3 created by user [email protected]
2020-12-11T20:24:01.868276+00:00 app[api]: Deploy 6cf5c835 by user [email protected]
2020-12-11T20:24:01.882709+00:00 app[api]: Scaled to web@1:Free by user [email protected]
2020-12-11T20:24:03.000000+00:00 app[api]: Build succeeded
2020-12-11T20:24:20.789955+00:00 heroku[web.1]: Starting process with command `npm start`
2020-12-11T20:24:23.757356+00:00 app[web.1]:
2020-12-11T20:24:23.757385+00:00 app[web.1]: > [email protected] start /app
2020-12-11T20:24:23.757385+00:00 app[web.1]: > node server.js
2020-12-11T20:24:23.757385+00:00 app[web.1]:
2020-12-11T20:24:24.472868+00:00 app[web.1]: Server running in port 51612
2020-12-11T20:24:24.477859+00:00 app[web.1]: Error: The `uri` parameter to `openUri()`
must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
2020-12-11T20:24:24.492425+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-12-11T20:24:24.492888+00:00 app[web.1]: npm ERR! errno 1
2020-12-11T20:24:24.502161+00:00 app[web.1]: npm ERR! [email protected] start: `node server.js`
2020-12-11T20:24:24.502402+00:00 app[web.1]: npm ERR! Exit status 1
2020-12-11T20:24:24.502771+00:00 app[web.1]: npm ERR!
2020-12-11T20:24:24.503019+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script.
2020-12-11T20:24:24.503226+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-12-11T20:24:24.513879+00:00 app[web.1]:
2020-12-11T20:24:24.514186+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-12-11T20:24:24.514389+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-12-11T20_24_24_504Z-debug.log
2020-12-11T20:24:24.593005+00:00 heroku[web.1]: Process exited with status 1
2020-12-11T20:24:24.635016+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-11T20:24:24.639143+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-11T20:24:36.357606+00:00 heroku[web.1]: Starting process with command `npm start`
2020-12-11T20:24:39.835796+00:00 app[web.1]:
2020-12-11T20:24:39.835825+00:00 app[web.1]: > [email protected] start /app
2020-12-11T20:24:39.835826+00:00 app[web.1]: > node server.js
2020-12-11T20:24:39.835826+00:00 app[web.1]:
2020-12-11T20:24:40.579267+00:00 app[web.1]: Server running in port 45105
2020-12-11T20:24:40.586201+00:00 app[web.1]: Error: The `uri` parameter to `openUri()`
must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
2020-12-11T20:24:40.627052+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-12-11T20:24:40.627605+00:00 app[web.1]: npm ERR! errno 1
2020-12-11T20:24:40.640045+00:00 app[web.1]: npm ERR! [email protected] start: `node server.js`
2020-12-11T20:24:40.640358+00:00 app[web.1]: npm ERR! Exit status 1
2020-12-11T20:24:40.640698+00:00 app[web.1]: npm ERR!
2020-12-11T20:24:40.640947+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script.
2020-12-11T20:24:40.641237+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-12-11T20:24:40.658260+00:00 app[web.1]:
2020-12-11T20:24:40.658681+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-12-11T20:24:40.658935+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-12-11T20_24_40_642Z-debug.log
2020-12-11T20:24:40.749017+00:00 heroku[web.1]: Process exited with status 1
2020-12-11T20:24:40.805611+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-11T20:29:46.891389+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=eb333c04-6d19-4b21-a2d7-f312ebb47b1f fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:29:48.246233+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=6258282a-dbb7-4e62-b7f2-5a1fed5293db fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:30:13.034422+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=3a4268c5-690f-4883-b993-f8d12db2f345 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:30:13.421890+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=35d9b71d-61c1-4a7a-8d80-9d33f7ed32d4 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:31:24.791202+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=11d42c40-257e-4348-be4d-09b6b782c056 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:31:25.375909+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=eaa2784e-764f-4175-97eb-bbe41f18ea2b fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:31:27.627505+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=e83e80ce-f962-4ce6-9b8d-87c120f07094 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:31:28.099932+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=aa178d8a-d73b-4837-95f5-96ffcc02e977 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:31:33.354137+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=b161efa6-0de6-4aa1-af88-7a45cddadcf3 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:31:33.875470+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=057d1141-e7b7-4b84-a78c-67a3dc6ef630 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:39:25.293591+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=02e8282d-a8c4-44e7-b3d7-e4cd9274bad5 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:39:25.685351+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=37fbd61b-afbd-4fe1-b71f-7515c1f324e7 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:49:19.637287+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-11T20:49:29.935874+00:00 heroku[web.1]: Starting process with command `npm start`
2020-12-11T20:49:32.124567+00:00 app[web.1]:
2020-12-11T20:49:32.124605+00:00 app[web.1]: > [email protected] start /app
2020-12-11T20:49:32.124606+00:00 app[web.1]: > node server.js
2020-12-11T20:49:32.124606+00:00 app[web.1]:
2020-12-11T20:49:32.647635+00:00 app[web.1]: Server running in port 46643
2020-12-11T20:49:32.654550+00:00 app[web.1]: Error: The `uri` parameter to `openUri()`
must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
2020-12-11T20:49:32.671713+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-12-11T20:49:32.672107+00:00 app[web.1]: npm ERR! errno 1
2020-12-11T20:49:32.680965+00:00 app[web.1]: npm ERR! [email protected] start: `node server.js`
2020-12-11T20:49:32.681166+00:00 app[web.1]: npm ERR! Exit status 1
2020-12-11T20:49:32.681390+00:00 app[web.1]: npm ERR!
2020-12-11T20:49:32.681578+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script.
2020-12-11T20:49:32.681741+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-12-11T20:49:32.687783+00:00 app[web.1]:
2020-12-11T20:49:32.688043+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-12-11T20:49:32.688208+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-12-11T20_49_32_682Z-debug.log
2020-12-11T20:49:32.740742+00:00 heroku[web.1]: Process exited with status 1
2020-12-11T20:49:32.773975+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-11T20:49:33.327610+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=d46ea6f3-be12-447d-9ccd-3825a593fb7a fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:49:33.891978+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=2afe9468-c8c1-4565-b55e-d57c588e39d8 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:50:33.225255+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=POST path = "/api/v1/transactions" host=polar-savannah-07066.herokuapp.com request_id=196c68e9-62d6-4e62-81f9-1dd68c4af7f0 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:50:53.210376+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/api/v1/transactions" host=polar-savannah-07066.herokuapp.com request_id=3b251fde-1cad-4aee-a49d-382f2d7cf5ed fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:57:21.497921+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=2ac730d1-0471-47a1-8191-933ed06cc189 fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T20:57:21.901255+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=fa30c7f0-d79d-42fb-8f8f-e9810c0b233d fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T21:01:58.905542+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/" host=polar-savannah-07066.herokuapp.com request_id=38c7db66-7aa4-4d42-97cb-4f7fc420ffdc fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
2020-12-11T21:01:59.211362+00:00 heroku[router]: at=error code=H10 desc = "App crashed" method=GET path = "/favicon.ico" host=polar-savannah-07066.herokuapp.com request_id=4dc1ec5c-818e-4c4d-a3ba-d61260bcbd8a fwd = "181.44.129.76" dyno= connect= service= status=503 bytes= protocol=https
В прошлом у меня была та же проблема, но я решил ее, просто обновив «Config Vars», но на этот раз это похоже на проблему с производством, когда сервер и приложение для реагирования создаются.
Я искал много руководств в Интернете и решения, но это все еще не работает.
вот конфигурация пакета JSON:
{
"name": "expense-tracker",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"client-install": "npm install --prefix client",
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"repository": {
"type": "git",
"url": "git+https://github.com/southamericanbear/gastos-tracker.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/southamericanbear/gastos-tracker/issues"
},
"homepage": "https://github.com/southamericanbear/gastos-tracker#readme",
"dependencies": {
"colors": "^1.4.0",
"concurrently": "^5.3.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mongoose": "^5.11.6",
"morgan": "^1.10.0"
}
}
Как вы можете видеть в этой строке:
The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
Эта проблема задана здесь раньше.
Проблема может быть в местоположении вашего файла env или в вашем MONGO_URI, указанном в вашем файле env.
Или вы можете проверить наличие других решений там.