Business Starter App and PWA

I’ve been a user of Vaadin 7 in the past, and a new project prompted me to explore Vaadin 14. I was especially interested in the ability to create Progressive web apps using only the @PWA annotation. I downloaded the business starter application, and successfully built and deployed onto a Payara app server, but when I load the application (successfully, btw), I don’t get the ability to install the PWA. The @PWA annotation is present in the code, but it doesn’t appear to have any effect on the ability to install the application in the browser.
Does anyone know why this is so? Perhaps something in the pom file that needs to be enabled?

Hi,
do you have all the required configuration in your PWA?
For the reference : https://github.com/vaadin/flow-and-components-documentation/blob/master/documentation/pwa/tutorial-pwa-introduction.asciidoc

I tested with a fresh download locally and I do get the install prompt (see attachment)

Does this occur on the server only or also if you run it on your local machine with mvn jetty:run?
17825520.jpg

What browsers are you testing with? The install prompt currenlty only works in Chrome, AFAIK.

Also, make sure to completely clear the browser cache/storage, that there aren’t any old things messing things up. Also, if you’ve previously installed the same app, the browser will not prompt you to install it again.

When I run the demo version, I see the install prompts. My local build doesn’t. I’m running it two ways: installed on a Payara 5 server, and as a mvn jetty:run from within netbeans. In both instances the application starts and runs fine, but I don’t get the install prompt.
I’ll try to clear cache and clean and build before trying again. I’ll leave an update here.
Thanks!

In your Chrome DevTools, go to the Application tab. Under it, there are two sub-tabs: Manifest and ServiceWorker. Check that both are showing content and not errors. If there are errors, paste them here and we can try to figure out what’s going on.

Marcus Hellberg:
In your Chrome DevTools, go to the Application tab. Under it, there are two sub-tabs: Manifest and ServiceWorker. Check that both are showing content and not errors. If there are errors, paste them here and we can try to figure out what’s going on.

Thanks for your help - I see that there is a manifest file, and the contents looks correct, however under the Instalability section, there are two warnings:
Page is not served from a secure origin.
No matching service worker detected. You may need to reload the page, or check that the service worker also controls the current page from the manifest.

The documentation for the @PWA annotation states:
When the @PWA annotation is found, Vaadin automatically generates a simple service worker during application startup.
So, I’m not sure why there isn’t a service worker, unless the worker isn’t loaded because of the secure origin warning.

Correct, Vaadin should create a ServiceWorker. So that seems to be the problem here.

Could you create a ticket on https://github.com/vaadin/flow with as much info on your specific setup as possible so we can take a closer look at what’s going on. Include any relevant server logs if there’s something that might be pointing to errors causing it not to get generated.

I found that adding the startPath parameter to the @PWA annotation somehow caused the ServiceWorker to be created. So, now I have a manifest and a serviceWorker visible in the developer view of the chrome tools. However, I still do not have the installation prompt visible that I see with the demo version of the same application as hosted from vaadin.com. Is it possible that this is because I’m using a self-signed certificate for my development machine?

Possibly. You should be able to install apps from localhost/127.0.0.1. If you’re hosting on a different device/IP you would need to have a valid cert.

Just to finish up - I am running the project from jetty within netbeans (mvn jetty:run), and as I said, there is a manifest and a service worker, but I do not get the install prompt, even when visiting the app from localhost:8080. Appreciate the help, but I’m guessing that something else is amiss here that I just haven’t been able to put my finger on. I should probably note that I am using a trial license to determine if this is something I want to continue with going forward. Thanks again.

All the PWA features are in the core so the trial license shouldn’t affect things. Things that pop into my mind that could cause issues are how the project is run, code modifications, browsers. Finding a setup that works helps pinpointing the problem.

Did I understand correctly that it was an unmodified version of Business App Starter that you have, and it doesn’t give you a install prompt?

I think a good way to debug this is to try with other clean Vaadin projects if you get the install prompt:

  • Hello world level - https://vaadin.com/start/latest - under “Create an empty project”. You can choose “Clean Java Servlet”, download, extract and run mvn jetty:run. Alternatively, if you leave the stack selection on “Spring boot”, the equivalent command is mvn spring-boot:run.
  • If that gives you the prompt, try downloading a fresh Business App Starter from https://vaadin.com/start/latest/business-app, and see if it gives you

I recommend running these from the terminal/command prompt just to rule out various servers and IDE integrations. Next, I would recommend testing another browsers to rule out chrome-compatible issues.