quickstart-js icon indicating copy to clipboard operation
quickstart-js copied to clipboard

Getting errors while developing firebase-cloud-messaging app

Open akash07k opened this issue 4 years ago • 5 comments

Step 1: Describe your environment

  • Operating system: _____
  • Browser: _____
  • Firebase SDK version: _____

Step 2: Describe the problem:

Steps to reproduce:




Observed Results:

  • What happened? This could be a description, logs, etc.

Expected Results:

  • What did you expect to happen?

Relevant Code:

// TODO(you): code here to reproduce the problem

So I'm developing a firebase cloud messaging app and getting some issues. I solved most of the issues by myself but still unable to find the solutions of some problems. The problem here is that I'm using SDK V9 and the code in this repo is not using the moduler code. Instead of it, still the old styled code is being used (compat) one and hence it is creating a lot of problem for new comers. My code is in below repo: https://github.com/firebase/quickstart-js And the first issue which I'm having is: FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('http://localhost:3000/firebase-cloud-messaging-push-scope') with script ('http://localhost:3000/firebase-messaging-sw.js'): ServiceWorker script evaluation failed (messaging/failed-service-worker-registration). at registerDefaultSw (registerDefaultSw.ts:43) at async updateSwReg (updateSwReg.ts:28) at async getToken$1 (getToken.ts:43)

akash07k avatar Sep 16 '21 21:09 akash07k

you should create a firebase-messaging-sw.js in root

iamnoufal avatar Oct 11 '21 04:10 iamnoufal

It would be great if you please provide some sample code for firebase messaging as well.

Feroz-Istar avatar Dec 04 '21 22:12 Feroz-Istar

It would be great if you please provide some sample code for firebase messaging as well.

I've done a firebase cloud messaging model. Do visit my repo https://github.com/Rahman24/fcm-example for a code model

iamnoufal avatar Dec 05 '21 04:12 iamnoufal

I have the same error when I go to version 9 and I don't know how to fix it, I followed the steps in the documentation and nothing i needed help

sebastam97 avatar Dec 09 '21 21:12 sebastam97

I have the same error when I go to version 9 and I don't know how to fix it, I followed the steps in the documentation and nothing i needed help

What is you problem? Please explain it briefly

iamnoufal avatar Dec 10 '21 06:12 iamnoufal