1

I get the following error whenever I run: 'heroku local web'

.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.lang.Integer] for value '$PORT'; nested exception is java.lang.NumberFormatException: For input string: "$PORT"

My Procfile looks like this:

web: java -Dserver.port=$PORT -jar build/libs/gs-spring-boot-0.1.0.jar

I am able to deploy to heroku, but I would like to be able to run locally to verify deployment before deploying remotely.

I have a windows PORT system environment variable, and a Heroku config variable set with 'heroku config:set PORT=8080.' I set each of these independently with no change in the above error. Anyone know why I getting this?

broadbear
  • 614
  • 8
  • 19
  • I have also tried 'heroku local web -p 8080' and get the same exception. A workaround is to replace '$PORT' with '8080' in the Procfile, but I would rather not do this if possible. – broadbear Mar 07 '16 at 19:50

1 Answers1

3

On Windows, you need to reference environment variables like %PORT% instead of the $ notation, which is *nix specific.

To fix this, you should create a Procfile.windows file with these contents:

web: java -Dserver.port=%PORT% -jar build\libs\gs-spring-boot-0.1.0.jar

And then run this command:

heroku local web -f Procfile.windows
codefinger
  • 10,088
  • 7
  • 39
  • 51