Quasar: Bad precaching request : SSR + PWA mode

Created on 18 Jun 2020  路  4Comments  路  Source: quasarframework/quasar

Describe the bug
I get the following error when running a production server with SSR + PWA:

logger.mjs:44 workbox Service worker installation failed. It will be retried automatically during the next navigation.
print @ logger.mjs:42
(anonymous) @ logger.mjs:56
(anonymous) @ precache.mjs:22
Promise.catch (async)
installListener @ precache.mjs:20
PrecacheController.mjs:194 Uncaught (in promise) bad-precaching-response: The precaching request for 'http://localhost:3000/quasar.client-manifest.json?__WB_REVISION__=4ff99738b81a0607690227454f9d44d0' failed with an HTTP status of 404.
    at PrecacheController._addURLToCache (https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-precaching.dev.js:445:15)
    at async Promise.all (index 0)
    at async PrecacheController.install (https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-precaching.dev.js:352:7)
WorkboxError @ WorkboxError.mjs:31
_addURLToCache @ PrecacheController.mjs:193

This happens because the client requests something outside of the /dist/www directory, which is not possible because of this code in /src-ssr/index.js

const serve = (path, cache) =>
  express.static(ssr.resolveWWW(path), {
    maxAge: cache ? 1000 * 60 * 60 * 24 * 30 : 0
  });

The link to the client manifest is in precache-manifest (which is in the /www folder):

self.__precacheManifest = (self.__precacheManifest || []).concat([
  {
    "revision": "4ff99738b81a0607690227454f9d44d0",
    "url": "/../quasar.client-manifest.json"
  },

To Reproduce
Steps to reproduce the behavior:

  1. quasar create temp (I used typescript, but don't think that is key)
  2. quasar mode add pwa
  3. quasar mode add ssr
  4. Enable pwa mode for SSR in quasar.conf.js
  5. quasar build -m ssr
  6. Check the dist/ssr folder and see where the quasar.client-manifest.jsonis located.

Expected behavior
quasar.client-manifest.json should be included in the /www folder if they are intended for the client.

Screenshots
If applicable, add screenshots to help explain your problem.
image

bug

Most helpful comment

To be more clear:

pwa: {
  workboxOptions: {
    exclude: [ '../quasar.client-manifest.json' ]

All 4 comments

Hi,

This is fixed in upcoming "@quasar/app" v2.

As a workaround until tomorrow (releasing q/app v2), you can manually add '../quasar.client-manifest.json' to quasar.conf.js > pwa > workboxOptions > exclude.

To be more clear:

pwa: {
  workboxOptions: {
    exclude: [ '../quasar.client-manifest.json' ]

Ok, clear. Thanks!

Was this page helpful?
0 / 5 - 0 ratings