heroku / heroku-sbt-plugin

An sbt plugin for deploying Heroku Scala applications
MIT License
111 stars 17 forks source link

No 'heroku' remote found, though herokuAppName is set. #32

Closed PerWiklander closed 9 months ago

PerWiklander commented 8 years ago
addSbtPlugin("com.heroku" % "sbt-heroku" % "1.0.1")

Deploying to Heroku works fine, but each run is ended by an IllegalArgumentException.

This is in my build.sbt:

herokuAppName in Compile := s"$name-${System.getProperty("appEnv", "staging")}"

But I still get this:

java.lang.IllegalArgumentException: Could not find app name: No 'heroku' remote found.
    at com.heroku.sdk.deploy.Deployer.<init>(Deployer.java:45)
    at com.heroku.sdk.deploy.BuildsDeployer.<init>(BuildsDeployer.java:24)
    at com.heroku.sdk.deploy.App.<init>(App.java:25)
    at com.heroku.sbt.SbtApp.<init>(SbtApp.scala:13)
    at com.heroku.sbt.HerokuPlugin$autoImport$$anonfun$baseHerokuSettings$2.apply(HerokuPlugin.scala:39)
    at com.heroku.sbt.HerokuPlugin$autoImport$$anonfun$baseHerokuSettings$2.apply(HerokuPlugin.scala:26)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:235)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: No 'heroku' remote found.
    at com.heroku.sdk.deploy.Toolbelt.getAppName(Toolbelt.java:24)
    at com.heroku.sdk.deploy.Deployer.<init>(Deployer.java:43)
    at com.heroku.sdk.deploy.BuildsDeployer.<init>(BuildsDeployer.java:24)
    at com.heroku.sdk.deploy.App.<init>(App.java:25)
    at com.heroku.sbt.SbtApp.<init>(SbtApp.scala:13)
    at com.heroku.sbt.HerokuPlugin$autoImport$$anonfun$baseHerokuSettings$2.apply(HerokuPlugin.scala:39)
    at com.heroku.sbt.HerokuPlugin$autoImport$$anonfun$baseHerokuSettings$2.apply(HerokuPlugin.scala:26)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:235)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
jkutner commented 8 years ago

What version of SBT? Also, what is the exact command you are running (sbt deployHeroku or something more complex)?

PerWiklander commented 8 years ago

sbt.version=0.13.9 sbt -DappEnv=staging deployHeroku

br-nezasa commented 7 years ago

Any developments on this? I got the same problem on with 'sbt 0.13.13' , 'herokuSkipSubProjects in Compile ' although it defaults to true, the plugin is trying to run against subprojects

br-nezasa commented 7 years ago

to anyone having the same problem, althoug herokuSkipSubProjectsis true, if you have a folder named project inside a subproject the plugin will try to run against it.

I just deleted/renamed the folder and problem solved

jkutner commented 7 years ago

@br-nezasa do you have a sample app/repo that I can use to reproduce the problem?

br-nezasa commented 7 years ago

@jkutner not public, just create a folder named project inside a subproject, you should be able to reproduce

make sure herokuSkipSubProjects = true

jkutner commented 7 years ago

@br-nezasa I haven't been able to reproduce this (but it's probably just due to my ignorance WRT multi-module sbt projects). If you can provide an example app, it will definitely help me get this done quicker.

Also, is your deploy success despite the error (as mentioned in OP)? Or do you get a failure?

tovbinm commented 4 years ago

Create a project with two subprojects:

proj1/
proj2/
project/
build.sbt

While build.sbt as follows

import Dependencies._

ThisBuild / scalaVersion := "2.13.1"
ThisBuild / version := "0.0.1"
ThisBuild / organization := "com.example"
ThisBuild / organizationName := "Example"

lazy val proj1 = (project in file("proj1"))
  .settings(commonSettings: _*)
  .enablePlugins(JavaAppPackaging)
  .settings(
    packageName in Docker := organization.value + "/proj1",
    version in Docker := version.value,
    herokuAppName in Compile := "app1"
  )

lazy val proj2 = (project in file("proj2"))
  .settings(commonSettings: _*)
  .enablePlugins(JavaAppPackaging)
  .settings(
    packageName in Docker := organization.value + "/proj2",
    version in Docker := version.value,
    herokuAppName in Compile := "app2"
  )
tovbinm commented 4 years ago

I found a workaround by deploying each subproject separately, i.e.

sbt proj1/stage proj1/deployHeroku
sbt proj2/stage proj2/deployHeroku
Malax commented 9 months ago

Closing this PR because this repository will be archived. See https://github.com/heroku/heroku-jvm-application-deployer for an alternative CLI to deploy locally compiled Scala applications.