Q:

Angular Push notification error in service worker, Unexpected token P in JSON at position 0

I am trying to use push notification in a pwa, but it is failing to receive the notification.
On the client side I am receiving the following error 
Uncaught SyntaxError: Unexpected token P in JSON at position 0
at Driver.onPush (ngsw-worker.js:1967)
at ngsw-worker.js:1871

I add an image that includes the data that reaches the service worker
As you can see in the previous image, the data field is empty, however when I send it I am adding a text
To test the application I am releasing the notification with the following:
https://web-push-codelab.glitch.me/
I already appreciate any contribution.

A:

If your payload is in any json format, like the one above, the error does not appear, but the notification is not shown in your client and no other error message is shown. You have to use a certain json format. One minimal working payload is:
{ "notification": {"title": "message title", "body": "message body"} }

I haven't found the exact and complete spec for this json, but here (search for "payload") you'll find a more complete example.

