vaadin (14.4.4) application : Failed to determine project directory for dev mode ... generates "flow-build-info.json" prior to deploying

(Vaadin version: 14.4.4)

Hi, I'm trying to deploy a Vaadin app on Google cloud platform (app engine). The app runs fine but I'm getting an error at deployment and the "502 bad gateway" error when I go to the website.

I followed this Vaadin tutorial for the deployment: https://vaadin.com/learn/tutorials/cloud-deployment/google

here is the error I'm getting at deployment:

java.lang.IllegalStateException: Failed to determine project directory for dev mode. Directory '/' does
not look like a Maven or Gradle project. Ensure that you have run the prepare frontend Maven goal, which
generates 'flow-build-info.json', prior to deploying your application

error message

...

I also got the same error when I containerized it locally with docker and ran it so the problem is not from google cloud. Could anybody help?


Solution 1:

You are either not running in production mode or you have not properly built your project.

For production mode, you need to set vaadin.productionMode=true - this can be done either as -D argument to the JVM, servlet properties, springboot properties, ... (all depending on your environment). Unless started with this setting, the vaadin server will complain (already before the error you have seen), that you are running in debug mode.

For building, this depends on the build tool/setup your are using. In general there are targets, that will build a production release (transpile all the libs, generate the missing build info, you saw in the logs, etc).

Using official plugins those targets are for the following build tools:

  • Gradle: vaadinBuildFrontend
  • Maven: vaadin:build-frontend

Also see https://vaadin.com/docs/flow/production/tutorial-production-mode-basic.html