web-push icon indicating copy to clipboard operation
web-push copied to clipboard

Deno Support

Open cirolosapio opened this issue 1 year ago • 1 comments

Setup

web-push Version: 3.6.7

  • [x] Chrome
  • [x] Firefox
  • [x] Opera for Android
  • [x] Samsung Internet Browser
  • [ ] Other

Problem

in a deno deploy environment the sendNotification works only without a payload

Expected

it should work with payload also

Features Used

  • [x] VAPID Support
  • [ ] GCM API Key
  • [x] Sending with Payload

Example / Reproduce Case

server

cirolosapio avatar Jun 15 '24 12:06 cirolosapio

I am using the following Deno version:

deno 1.44.4 (release, x86_64-apple-darwin)
v8 12.6.228.9
typescript 5.4.5

Currently, the reason why it works in Deno environment without a payload is because the browser recipient that receives the notification payload doesn't have anything to decrypt so it'll work fine.

If you add a payload, and run sendNotification in Deno environment, the browser recipient needs to decrypt the notification payload it but it can't decrypt the payload upon receiving it. This might have to do with Deno's encryption implementation details vs Node.js because it works perfectly fine for me with a payload in a Node.js environment (I tested using node v21.2.0).

If you are using chrome as the browser recipient and observe the message logs using chrome://gcm-internals and attempt to use sendNotification with a payload in a Deno environment (for me, Deno 1.44.4), you will get a AES-GCM decryption failed in the Message Decryption Failure Log like so:

Screenshot 2024-07-04 at 3 03 37 PM

ktn1234 avatar Jul 04 '24 20:07 ktn1234

According to https://github.com/denoland/deno/issues/23693#issuecomment-2315268504 this is actually actually fixed now.

alexgleason avatar Oct 07 '24 19:10 alexgleason

Thanks, that's good to hear!

marco-c avatar Oct 08 '24 08:10 marco-c