mjakobis
mjakobis

Reputation: 31

WebAPK creation failures on Android over VPN

My corporate VPN blocks all external traffic from an Android device. I am trying to test PWA that is internally hosted (all resources inside a firewall). What I observe is that despite passing Lighthouse audit my PWA fails the WebAPK creation process on a device. Specifically, the install process takes a long time, and eventually it degrades to an application shortcut install.

What I did:

  1. Built the simplest PWA that I could think of (index.html registering service worker + sw.js with fetch even handling index.html request offline + web manifest) and hosted it on an internal server
  2. Run Lighthouse audit on the desktop and made sure it passes all PWA Lighthouse audits
  3. Run bubblewrap init on the manifest to double check that icons/names are OK
  4. Tried to install PWA on an a Pixel phone from Chrome's dot dot dot menu behind firewall
  5. After a long time, the application shortcut was installed (with Chrome overlay icon)
  6. Checked chrome://webapks/ on my phone - no surprises here, I did not find WebAPK for my app
  7. Turn on my corporate VPN workaround, which allows me to bypass VPN restrictions and access external addresses (rooted phone + ProxyDroid hackery)
  8. Now WebAPK creation works

Question 1:

Could someone please explain what is involved in WebAPK creation that would make it fail behind a strict corporate firewall? Is there any external resource (a service perhaps?) involved here that I could advocate my corporate VPN to whitelist? If not, any advice of how to have automatic tests for WebAPK creation would be appreciated. I thought of using bubblewrap build, but, since it is for TWA's, I did not expected it to pass for my simple PWA.

Question 2:

In general, what is the best technique for diagnosing WebAPK creation failures for PWA's that pass Lighthouse audit?

Upvotes: 3

Views: 1131

Answers (1)

PeteLe
PeteLe

Reputation: 1943

The WebAPK is generated server-side by Chrome. Chrome sends details from the manifest, along with the icons to it's server, which then returns the WebAPK. As you pointed out, it's most likely your corporate firewall is blocking that request to the server, preventing Chrome from generating the WebAPK.

The code for generating WebAPKs in Chrome can be found here

For your second question, we don't really have good tools for debugging that, if Lighthouse passes, it should build the WebAPK (with the exception noted above). I suspect you could connect the device to your computer and use ADB to look at logs, but thats... ugly. Sorry.

Upvotes: 2

Related Questions