For my app I have my Postgres database deployed to AWS, server (Node and Express) and client (React) separately deployed to Heroku. My client application keeps crashing though and I'm unsure why. Everything works when run locally.
2020-05-01T17:18:33.292129+00:00 app[web.1]: > jepurdy#0.1.0 start /app
2020-05-01T17:18:33.292130+00:00 app[web.1]: > react-scripts start
2020-05-01T17:18:33.292130+00:00 app[web.1]:
2020-05-01T17:18:36.464174+00:00 app[web.1]: ℹ 「wds」: Project is running at http://172.18.97.46/
2020-05-01T17:18:36.464711+00:00 app[web.1]: ℹ 「wds」: webpack output is served from
2020-05-01T17:18:36.464811+00:00 app[web.1]: ℹ 「wds」: Content not from webpack is served from /app/public
2020-05-01T17:18:36.464902+00:00 app[web.1]: ℹ 「wds」: 404s will fallback to /
2020-05-01T17:18:36.465139+00:00 app[web.1]: Starting the development server...
2020-05-01T17:18:36.465140+00:00 app[web.1]:
2020-05-01T17:18:36.613427+00:00 heroku[web.1]: State changed from starting to crashed
2020-05-01T17:18:37.853487+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=jepurdy.herokuapp.com request_id=01b14ed3-4b6c-44e1-a2c9-7cfbd728b7ad fwd="75.155.134.45" dyno= connect= service= status=503 bytes= protocol=https
2020-05-01T17:18:38.248004+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=jepurdy.herokuapp.com request_id=a3519a2e-1ef9-49be-baa4-d4ed19f9d833 fwd="75.155.134.45" dyno= connect= service= status=503 bytes= protocol=https
Here's the package.json for the client:
{
"name": "jepurdy",
"version": "0.1.0",
"private": true,
"dependencies": {
"#material-ui/core": "^4.9.7",
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.3.2",
"#testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"node-sass": "^4.14.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"react-spinners-css": "^1.1.7",
"socket.io": "^2.3.0",
"socket.io-client": "^2.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"proxy": "http://localhost:8080"
}
Related
I'm developing a simple API in NodeJS + a telegram bot client in php.
The project is hosted with Heroku with webhook method.
The telegram bot is not responding?
This are the heroku logs of my app:
heroku[router]: at=info method=POST path="/index.php" host=movie-bot-prova.herokuapp.com request_id=9f6da3f1-22c8-4844-804c-7ce15a7fed83 fwd="91.108.6.67" dyno=web.1 connect=0ms service=1ms status=404 bytes=393 protocol=https
This is the Procfile
web: node server.js
This is the package.json
{
"name": "progetto_pdgt",
"version": "1.0.0",
"description": "* [F..... O....... matricola n°286732] (https://github.com/Franci-75)",
"main": "server.js",
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Franci-75/movie-bot-prova.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/Franci-75/movie-bot-prova/issues"
},
"homepage": "https://github.com/Franci-75/movie-bot-prova#readme",
"dependencies": {
"express": "^4.18.1",
"axios": "0.27.2"
}
}
This is the response of "getWebhookInfo" of my Telegram bot
{"ok":true,"result":{"url":"https://movie-bot-prova.herokuapp.com/index.php","has_custom_certificate":false,"pending_update_count":11,"last_error_date":1657647343,"last_error_message":"Wrong response from the webhook: 404 Not Found","max_connections":40,"ip_address":".............."}}
What am I missing here? It doesn't tell me anything, I don't know where I might have gone wrong?
Maybe you made it in the right way, but the first thing I want to check to help you is how to set webhook, do this (obv put there your token and the https page of yourn script):
https://api.telegram.org/bot TOKEN /setWebhook?url= THE SCRIPT ON YOUR HOST (USE HTTPS)
Example
https://api.telegram.org/bot43h45ui5h123443/setWebhook?url=https://www.example.com/index.php
Just digit in on web
Please help, I am having this issue while deploying my nextjs app in Heroku, the app runs fine locally.
Below is the log from Heroku and my package.json file.
Log:
2021-08-13T07:26:20.752659+00:00 app[web.1]:
2021-08-13T07:26:20.752685+00:00 app[web.1]: > # start /app
2021-08-13T07:26:20.752688+00:00 app[web.1]: > next start -p $PORT
2021-08-13T07:26:20.752689+00:00 app[web.1]:
2021-08-13T07:26:20.763505+00:00 app[web.1]: sh: 1: next: not found
2021-08-13T07:26:20.769117+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-08-13T07:26:20.769496+00:00 app[web.1]: npm ERR! syscall spawn
2021-08-13T07:26:20.769568+00:00 app[web.1]: npm ERR! file sh
2021-08-13T07:26:20.769636+00:00 app[web.1]: npm ERR! errno ENOENT
2021-08-13T07:26:20.772506+00:00 app[web.1]: npm ERR! # start: `next start -p $PORT`
2021-08-13T07:26:20.772533+00:00 app[web.1]: npm ERR! spawn ENOENT
package.json:
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start -p $PORT"
},
"dependencies": {
"#heroicons/react": "^1.0.3",
"next": "latest",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"tailwind-scrollbar-hide": "^1.0.3"
},
"devDependencies": {
"autoprefixer": "^10.2.6",
"postcss": "^8.3.5",
"tailwindcss": "^2.2.4"
}
}
I started a project with Vuejs and Laravel using Laravel Mix.
It works for the most part, but when I'm trying to divide my component up into separate files and load them in the .vue file like this:
<template src="./comp.html"></template>
<script src="./comp.ts" lang="ts"></script>
<style src="./comp.scss" scoped lang="scss"></style>
I'm getting this error:
error in ./resources/js/components/comp/comp.html?vue&type=template&id=c2090546&scoped=true
Module Error (from ./node_modules/vue-loader/dist/templateLoader.js):
VueCompilerError: Unquoted attribute value cannot contain U+0022 ("), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).
at /home/geordyd/projects/pension-tool/htdocs/resources/js/components/comp/comp.html:2:35
1 | // Module
2 | var code = "<section class=\"comp\">\n <h1>comp Component</h1>\n</section>\n\n";
| ^
3 | // Exports
4 | module.exports = code;
I get this output in the browser:
package.json:
{
"private": true,
"scripts": {
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"production": "mix --production"
},
"devDependencies": {
"#vue/compiler-sfc": "^3.0.3",
"axios": "^0.19",
"bootstrap": "^4.5.3",
"cross-env": "^7.0.2",
"jquery": "^3.5.1",
"laravel-mix": "^6.0.0-beta.14",
"lodash": "^4.17.19",
"node-sass": "^5.0.0",
"postcss": "^8.1.10",
"resolve-url-loader": "^3.1.0",
"sass": "^1.29.0",
"sass-loader": "^10.1.0",
"vue-class-component": "^8.0.0-0",
"vue-loader": "^16.0.1"
},
"dependencies": {
"#types/webpack-env": "^1.16.0",
"#vue/cli-plugin-typescript": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"core-js": "^3.6.5",
"ts-loader": "^8.0.11",
"typescript": "~3.9.3",
"vue": "^3.0.3",
"vue-cli-plugin-vue-next": "^0.1.4"
}
}
tsconfig.json:
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env"
]
},
"types": [
"webpack-env"
],
"include": [
"resources/js/**/*"
],
"exclude": [
"node_modules"
]
}
webpack.mix.js:
const mix = require('laravel-mix');
mix.ts('resources/js/app.ts', 'public/js').vue()
.sass('resources/sass/app.scss', 'public/css');
I tried downgrading the vue-loader package, but it did not work.
Changing comp.html to var code = '<section class="comp"><br><h1>comp Component</h1><br></section><br><br>' gives this as output in the browser:
i think you have to use require in the src.
<template :src="require('./comp.html')"></template>
<script :src="require('./comp.ts"') lang="ts"></script>
<style :src="require('./comp.scss"') scoped lang="scss"></style>
It was a problem with Laravel Mix.
The developer already fixed it.
Link to github issue:
https://github.com/JeffreyWay/laravel-mix/issues/1893#event-4074240275
I'm getting this error when i deploy my NodeJS app to Heroku server.
2019-08-27T05:54:03.597197+00:00 heroku[web.1]: State changed from starting to crashed
2019-08-27T05:54:03.569746+00:00 heroku[web.1]: Process exited with status 1
2019-08-27T05:59:55.107447+00:00 heroku[web.1]: State changed from crashed to starting
2019-08-27T05:59:58.079934+00:00 heroku[web.1]: Starting process with command `npm start`
2019-08-27T06:00:00.687008+00:00 heroku[web.1]: State changed from starting to crashed
2019-08-27T06:00:00.660988+00:00 heroku[web.1]: Process exited with status 1
2019-08-27T06:00:00.452248+00:00 app[web.1]: > realtime-chat#1.0.0 start /app
2019-08-27T06:00:00.452250+00:00 app[web.1]: > node index.js
2019-08-27T06:00:00.452252+00:00 app[web.1]:
2019-08-27T06:00:00.574510+00:00 app[web.1]: /app/index.js:1
2019-08-27T06:00:00.574514+00:00 app[web.1]: import express from "express";
2019-08-27T06:00:00.574517+00:00 app[web.1]: ^^^^^^^
2019-08-27T06:00:00.574519+00:00 app[web.1]:
2019-08-27T06:00:00.581327+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-08-27T06:00:00.581759+00:00 app[web.1]: npm ERR! errno 1
2019-08-27T06:00:00.582977+00:00 app[web.1]: npm ERR! realtime-chat#1.0.0 start: `node index.js`
2019-08-27T06:00:00.583139+00:00 app[web.1]: npm ERR! Exit status 1
2019-08-27T06:00:00.583436+00:00 app[web.1]: npm ERR!
2019-08-27T06:00:00.583640+00:00 app[web.1]: npm ERR! Failed at the realtime-chat#1.0.0 start script.
2019-08-27T06:00:00.583830+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-08-27T06:00:00.593702+00:00 app[web.1]:
My config: package.json file.
{
"name": "realtime-chat",
"version": "1.0.0",
"description": "sjc-realtimechat",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "babel-node index.js",
"postinstall": "bower cache clean && bower install"
},
"keywords": [
"sjc"
],
"author": "sjc-bui",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"bcrypt": "^3.0.6",
"bluebird": "^3.5.5",
"body-parser": "^1.19.0",
"bower": "^1.8.8",
"connect-mongo": "^3.0.0",
"cookie-parser": "^1.4.4",
"dotenv": "^8.0.0",
"ejs": "^2.6.2",
"emojione": "^4.5.0",
"express": "^4.17.1",
"express-flash": "0.0.2",
"express-session": "^1.16.2",
"express-validator": "^6.1.1",
"fs-extra": "^7.0.1",
"google-translate": "^2.2.0",
"http": "0.0.0",
"https": "^1.0.0",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"mongoose": "^5.6.4",
"multer": "^1.4.1",
"nodemailer": "^4.4.2",
"passport": "^0.4.0",
"passport-google-oauth": "^2.0.0",
"passport-local": "^1.0.0",
"passport.socketio": "^3.7.0",
"request": "^2.88.0",
"socket.io": "^2.2.0",
"uuid": "^3.3.2"
},
"devDependencies": {}
}
My config: Procfile file
web: npm start
i'm trying to run babel-node index.js on server. but got this error
npm ERR! realtime-chat#1.0.0 start: node index.js
I was searching to fix it but still got this error. Please help.
Update
Dependences already installed but still got "npm start" error.
Update all required dependencies in your package.json.
package.json should be something similar to this :
{
"name": "sample name",
"version": "version details goes here",
"description": "description goes here",
"main": "index.js",
"scripts": {
"start": "babel-node index.js",
"dev": "nodemon --exec babel-node index.js",
"test": "mocha --require babel-core/register test/*.js",
"compile": "babel src --out-dir .compiled --source-maps --watch",
"postinstall": "bower cache clean && bower install"
},
"dependencies": {
"express": "^4.9.8",
"other dependencies"
},
"engines": {
"node": "put node version details here"
}
}
update your bablerc file as below:
babelrc content
{
"presets": ["#babel/preset-env"]
}
Babel node is missing from your dependencies list.
also, see this below guide for more details:
https://devcenter.heroku.com/articles/deploying-nodejs
you cannot use
import express from "express"
this is ES-15 modules and Node.js does not support this. React supports this. node.js runtime has support for common.js modules which should be like this:
const express=require("express")
I have a Nodejs app that is running fine on my local machine. I am trying to deploy to Heroku. The deployment works but the application fails to start. I am using Koa and Typescript. I first received a "Nodemon not found error" and added the Procfile that seemed to resolve that. However, I have no idea how to resolve this new error.
I am deploying this directly from Github (e.g. I push to Git and deploy to Heroku from there).
Thanks for looking
Heroku Logs Error
019-06-24T10:55:35.628075+00:00 heroku[web.1]: State changed from crashed to starting
2019-06-24T10:55:40.080980+00:00 heroku[web.1]: Starting process with command `node src/server.ts` )
2019-06-24T10:55:42.382747+00:00 heroku[web.1]: State changed from starting to crashed
2019-06-24T10:55:42.361956+00:00 heroku[web.1]: Process exited with status 1
2019-06-24T10:55:42.287058+00:00 app[web.1]: /app/src/server.ts:1
2019-06-24T10:55:42.287088+00:00 app[web.1]: import { config } from './config/config';
2019-06-24T10:55:42.287091+00:00 app[web.1]: ^
2019-06-24T10:55:42.287093+00:00 app[web.1]:
2019-06-24T10:55:42.287094+00:00 app[web.1]: SyntaxError: Unexpected token {
2019-06-24T10:55:42.287097+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:721:23)
2019-06-24T10:55:42.287099+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2019-06-24T10:55:42.287101+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:653:32)
2019-06-24T10:55:42.287103+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2019-06-24T10:55:42.287105+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2019-06-24T10:55:42.287106+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
2019-06-24T10:55:42.287108+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-06-24T10:55:42.287111+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Procfile
web: node src/server.ts
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"paths": { "*": ["types/*"] },
"noImplicitAny": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution" : "node",
"lib": [
"es2018"
],
"types": [
"node"
],
"sourceMap": true,
"baseUrl": "./src"
},
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
package.json
{
"name": "graphql-api",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "cross-env NODE_PATH=./src mocha --timeout 25000 --exit -r ts-node/register ./test/**/*.test.ts",
"start": "nodemon"
},
"author": "",
"license": "ISC",
"devDependencies": {
"nodemon": "^1.19.1",
"typescript": "^3.5.1",
"chai": "^4.2.0",
"chai-http": "^4.3.0",
"mocha": "^6.1.4"
},
"dependencies": {
"#babel/runtime": "^7.4.5",
"#types/mocha": "^5.2.7",
"#types/neo4j": "^2.0.2",
"apollo-server": "^2.6.2",
"apollo-server-koa": "^2.6.3",
"babel-plugin-transform-runtime": "^6.23.0",
"bcryptjs": "^2.4.3",
"dotenv": "^8.0.0",
"fs": "0.0.1-security",
"graphql": "^14.3.1",
"graphql-voyager": "^1.0.0-rc.27",
"knex": "^0.17.6",
"koa": "^2.7.0",
"koa-bodyparser": "^4.2.1",
"koa-passport": "^4.1.3",
"koa-router": "^7.4.0",
"koa-session": "^5.12.0",
"moment": "^2.24.0",
"neo4j-driver": "^1.7.5",
"neo4j-graphql-js": "^2.5.0",
"parse-neo4j": "^0.6.11",
"passport": "^0.4.0",
"passport-local": "^1.0.0",
"path": "^0.12.7",
"pg": "^7.11.0",
"ts-node": "^8.2.0",
"tsconfig-paths": "^3.8.0",
"winston": "^3.2.1"
}
}
nodemon.json
{
"watch": ["./src"],
"ext": "ts",
"exec": "ts-node -r tsconfig-paths/register ./src/server.ts",
"ignore": ["database/migrations/*"]
}