Akshay Rajvanshi
Akshay Rajvanshi

Reputation: 11

Error deploying Spring Boot + Reacts JS app on Heroku - app crashed

I'm trying to set up my Spring Boot + React JS application on Heroku. However, whenever I try to deploy it, the build is successful, but the app is crashing when I check the logs.

I tried changing the proxy to the Heroku app web link but that didn't seem to work.

This is my package.json:

{
  "name": "frontend",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": "12.10.0",
    "npm": "6.10.3"
  },
  "dependencies": {
    "react": "^16.10.0",
    "react-dom": "^16.10.0",
    "react-scripts": "3.1.2",
    "yarn": "^1.17.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "move-build": "mkdir -p ../main/resources/static && mv build/* ../main/resources/static/",
    "clean-old-build": "rm -rf ../main/resources/static/* ",
    "clean-new-build": "rm -rf build"
  },
  "proxy": "http://yumdrop.herokuapp.com",
  "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"
    ]
  }
}

And here is the Procfile:

web: java -D server.port=$PORT $JAVA_OPTS -jar target/yumdrop-0.0.1-SNAPSHOT.jar

application.properties file:

spring.mvc.view.suffix = .html
server.port=${PORT:8080}

Heroku logs:

2019-10-01T23:47:08.000000+00:00 app[api]: Build started by user
2019-10-01T23:48:35.397819+00:00 app[api]: Release v17 created by user
2019-10-01T23:48:35.675405+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-01T23:48:35.397819+00:00 app[api]: Deploy 2beea1a1 by user [email protected]
2019-10-01T23:48:41.000000+00:00 app[api]: Build succeeded
2019-10-01T23:48:43.535207+00:00 heroku[web.1]: Starting process with command `java -D server.port=58532 $JAVA_OPTS -jar target/yumdrop-0.0.1-SNAPSHOT.jar`
2019-10-01T23:48:45.401349+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-01T23:48:45.381345+00:00 heroku[web.1]: Process exited with status 1
2019-10-01T23:48:45.171743+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2019-10-01T23:48:45.179027+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2019-10-01T23:48:45.321390+00:00 app[web.1]: Error: Could not find or load main class server.port=58532
2019-10-01T23:57:46.000000+00:00 app[api]: Build started by user [email protected]
2019-10-01T23:59:18.665881+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-01T23:59:18.387311+00:00 app[api]: Release v18 created by user
2019-10-01T23:59:18.387311+00:00 app[api]: Deploy 88f083f1 by user 

Upvotes: 1

Views: 425

Answers (1)

codefinger
codefinger

Reputation: 10318

-D server.port=$PORT should be -Dserver.port=$PORT

Upvotes: 1

Related Questions