Firebase Push notification not working in quasar framework n Vue.js

  • I am using firebase to send push notification inside quasar framework. Its working fine locally.
    But when we deploy code to dev server .
    Then it gives error:-Failed to register a ServiceWorker: A bad HTTP res…code (404) was received when fetching the script.

    Because after building quasar app it generate its own service-worker.js file when we want to add code or add our own service woker then it dosenot work.

    1.Please tell me how to use our own firease-messaging-sw.js in place of quasar generated service-worker.js.
    Becouse for firebase push notification search service worker file with name of " firease-messaging-sw.js"
    2.Even i add my code to service-worker.js then also it dont reflect in code.

    Thanks in advance

  • Hi, I’m having a similar problem, I can’t find a way to use firebase-messaging-sw.js instead of custom-service-worker.js (or additionally). Did you solve the problem? Thanks!

  • /node_modules/@firebase/messaging/dist/index.cjs.js

    You will find index.esm.js, and also at above location.Total 4 files.

    var DEFAULT_SW_PATH = ‘/service-worker.js’;
    var DEFAULT_SW_SCOPE = ‘/’;

    Do above two changes wherever you find DEFAULT_SW_PATH and DEFAULT_SW_SCOPE
    then build again, everything will work fine.

Log in to reply