Vaadin 14 on heroku issue

I have problem when deploying Vaadin 14 app on Heroku. This is heroku logs:

2019-10-23T19:34:19.005415+00:00 app[web.1]
: 2019-10-23 19:34:19.004 ERROR 4 --- [           main]
 o.a.c.c.C.[Tomcat]
.[localhost]
.
[/]
     : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitialize
r$DevModeServletContextListener]
2019-10-23T19:34:19.005427+00:00 app[web.1]
:
2019-10-23T19:34:19.005432+00:00 app[web.1]
: java.lang.IllegalStateException: Running project in development mode with no access to fol
der '/tmp/build_1eb1799fb4903b1c64716231dcb4a093'.
2019-10-23T19:34:19.005435+00:00 app[web.1]
: Build project in production mode instead, see https://vaadin.com/docs/v14/flow/production/
tutorial-production-mode-basic.html
2019-10-23T19:34:19.005436+00:00 app[web.1]
: at com.vaadin.flow.server.DeploymentConfigurationFactory.verifyFolderExists(DeploymentConf
igurationFactory.java:283) ~[flow-server-2.0.14.jar!/:2.0.14]

2019-10-23T19:34:19.005438+00:00 app[web.1]
: at com.vaadin.flow.server.DeploymentConfigurationFactory.readBuildInfo(DeploymentConfigura
tionFactory.java:222) ~[flow-server-2.0.14.jar!/:2.0.14]

2019-10-23T19:34:19.005439+00:00 app[web.1]
: at com.vaadin.flow.server.DeploymentConfigurationFactory.createInitParameters(DeploymentCo
nfigurationFactory.java:166) ~[flow-server-2.0.14.jar!/:2.0.14]

2019-10-23T19:34:19.005441+00:00 app[web.1]
: at com.vaadin.flow.server.DeploymentConfigurationFactory.createPropertyDeploymentConfigura
tion(DeploymentConfigurationFactory.java:126) ~[flow-server-2.0.14.jar!/:2.0.14]

2019-10-23T19:34:19.005445+00:00 app[web.1]
: at com.vaadin.flow.spring.VaadinServletContextInitializer$SpringStubServletConfig.createDe
ploymentConfiguration(VaadinServletContextInitializer.java:747) ~[vaadin-spring-12.0.6.jar!/:na]

2019-10-23T19:34:19.005447+00:00 app[web.1]
: at com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener.co
ntextInitialized(VaadinServletContextInitializer.java:289) ~[vaadin-spring-12.0.6.jar!/:na]

2019-10-23T19:34:19.005449+00:00 app[web.1]
: at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4680) [tomc
at-embed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.00545+00:00 app[web.1]
: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5143) [tomca
t-embed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005451+00:00 app[web.1]
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core
-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005452+00:00 app[web.1]
: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) [tomcat
-embed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005454+00:00 app[web.1]
: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) [tomcat
-embed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005456+00:00 app[web.1]
: at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_222-heroku]

2019-10-23T19:34:19.005457+00:00 app[web.1]
: at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java
:75) [tomcat-embed-core-9.0.22.jar!/:9.0.22]

2019-10-23T19:34:19.005458+00:00 app[web.1]
: at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [
na:1.8.0_222-heroku]

2019-10-23T19:34:19.00546+00:00 app[web.1]
: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) [tomcat-emb
ed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005461+00:00 app[web.1]
: at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) [tomcat-embe
d-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005462+00:00 app[web.1]
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core
-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005464+00:00 app[web.1]
: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) [tomcat
-embed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005465+00:00 app[web.1]
: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) [tomcat
-embed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005466+00:00 app[web.1]
: at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_222-heroku]

2019-10-23T19:34:19.005467+00:00 app[web.1]
: at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java
:75) [tomcat-embed-core-9.0.22.jar!/:9.0.22]

2019-10-23T19:34:19.005469+00:00 app[web.1]
: at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [
na:1.8.0_222-heroku]

2019-10-23T19:34:19.00547+00:00 app[web.1]
: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) [tomcat-emb
ed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005472+00:00 app[web.1]
: at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) [tomcat-
embed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005473+00:00 app[web.1]
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core
-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005474+00:00 app[web.1]
: at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) [tomca
t-embed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005475+00:00 app[web.1]
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core
-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005485+00:00 app[web.1]
: at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) [tomcat-
embed-core-9.0.22.jar!/:9.0.22]
2019-10-23T19:34:19.005487+00:00 app[web.1]
: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [tomcat-embed-core
-9.0.22.jar!/:9.0.22]

Due to logs the problem is in production mode. But I’ve set heroku SPRING_PROFILES_ACTIVE environment variable to production.

heroku config:set SPRING_PROFILES_ACTIVE=production

Here is the pom.xml (build and profiles part)

<build>
        <defaultGoal>spring-boot:run</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!-- Clean build and startup time for Vaadin apps sometimes may exceed
                     the default Spring Boot's 30sec timeout.  -->
                <configuration>
                    <wait>500</wait>
                    <maxAttempts>240</maxAttempts>
                </configuration>
            </plugin>

            <!--
                Take care of synchronizing java dependencies and imports in
                package.json and main.js files.
                It also creates webpack.config.js if not exists yet.
            -->
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-frontend</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <!-- Use the latest released version:
                https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
                <version>1.8.0</version>

                <executions>
                    <execution>
                        <!-- optional: you don't really need execution ids, but it looks nice in your build log. -->
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <!-- optional: default phase is "generate-resources" -->
                        <phase>generate-resources</phase>
                    </execution>
                </executions>
                <configuration>
                    <nodeVersion>v10.16.2</nodeVersion>

                    <!-- optional: with node version greater than 4.0.0 will use npm provided by node distribution -->
                    <!--                    <npmVersion>2.15.9</npmVersion>-->

                    <!-- optional: where to download node and npm from. Defaults to https://nodejs.org/dist/ -->
                    <!--                    <downloadRoot>http://myproxy.example.org/nodejs/</downloadRoot>-->
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>production</id>
            <properties>
                <vaadin.productionMode>true</vaadin.productionMode>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.vaadin</groupId>
                    <artifactId>flow-server-production-mode</artifactId>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <version>${vaadin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-frontend</goal>
                                    <goal>build-frontend</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
	</profiles>

What am I doing wrong? I had no such problems deploying Vaadin 13 app on heroku.

I have solved my problem. Here is [the solution]
(https://ramonak.io/posts/how-to-deploy-vaadin-14-app-to-heroku/)

I struggle with the same problem.

Your link to solution is not working. Do you have a working example please (github for example).

Or a tutorial on how to configure heroku and vaadin+spring.

thank you

Sylvain Auger-Léger:
I struggle with the same problem.

Your link to solution is not working. Do you have a working example please (github for example).

Or a tutorial on how to configure heroku and vaadin+spring.

thank you

I’ve updated the link (sorry for the wrong link). And there is a link to the working example on GitHub at the end of the blog post. Hope it helps!

In addition to the great tutorial Kate wrote and shared, you could also want to check our updated tutorial for Heroku. For example, deploying a jar is discussed as an additional option

https://vaadin.com/learn/tutorials/cloud-deployment/heroku#_deploying_from_the_command_line :slight_smile: