Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTL doesn't seem to be honored #284

Open
4 tasks done
sathia-musso opened this issue Jun 23, 2017 · 16 comments
Open
4 tasks done

TTL doesn't seem to be honored #284

sathia-musso opened this issue Jun 23, 2017 · 16 comments

Comments

@sathia-musso
Copy link

sathia-musso commented Jun 23, 2017

Setup

Operating System: Linux
Node Version: v6.2.2
web-push Version: ^3.2.2

Browser

  • Chrome

Problem

TTL is not honored, if I set 7200 seconds it is still shown the next morning when I fire up the browser

Expected

Notifications should expire after TTL seconds

Features Used

  • VAPID Support
  • GCM API Key
  • Sending with Payload

Example / Reproduce Case

const payload = new Buffer('{"title": "'+urldecode(title)+'", "body": "'+urldecode(body)+'", "icon": "'+icon+'", "href": "'+href+'", "tag": "'+tag+'"}', 'utf8');

const options = { TTL: 7200 }

webpush.sendNotification(subscription, payload, options).then(function(response) {
  console.log(JSON.stringify(response));
});
@marco-c
Copy link
Member

marco-c commented Jun 23, 2017

Which version of Chrome?

@sathia-musso
Copy link
Author

Version 58.0.3029.110 (64-bit)

@gauntface
Copy link

could you please file this on crbug.com

@marco-c
Copy link
Member

marco-c commented Jun 30, 2017

@sathio did you file a bug on crbug.com? Can you link it here?

@sathia-musso
Copy link
Author

Hi, I will file an issue today, but I'm not yet convinced this is on chrome/chromium side.
Isn't there a way to understand what headers are sent exactly to the FCM server?

@marco-c
Copy link
Member

marco-c commented Jun 30, 2017

Isn't there a way to understand what headers are sent exactly to the FCM server?

You can add some logging here if you want: https://github.com/web-push-libs/web-push/blob/master/src/web-push-lib.js#L265.
We have tests that check the TTL header is present though, so it shouldn't be a bug on our side.

@sathia-musso
Copy link
Author

sathia-musso commented Jun 30, 2017

Here's a detailed response, HEADERS are from the web-push-lib.js file as you've suggested.

[
  {
    "message":"sent",
    "title":"'title'",
    "body":"'body'",
    "icon":"'icon'",
    "href":"'href'",
    "tag":"'tag'",
    "res":[
    "HEADERS { hostname: 'android.googleapis.com',",
     " port: null,",
      " path: '/gcm/send/c7qnskTew5w:[redacted]',",
      " headers:",
      " { TTL: 7200,",
      " 'Content-Length': 440,",
      " 'Content-Type': 'application/octet-stream',",
      " 'Content-Encoding': 'aesgcm',",
      " Encryption: 'salt=[redacted]',",
      " 'Crypto-Key': 'dh=[redacted]',",
      " Authorization: 'key=[redacted]' },",
      " method: 'POST' }",
        {
          "statusCode":201,
          "body":"",
          "headers":{
              "content-type":"text/plain",
              "location":"https://android.googleapis.com/gcm/0:[redacted]",
              "date":"Fri, 30 Jun 2017 08:15:32 GMT",
              "expires":"Fri, 30 Jun 2017 08:15:32 GMT",
              "cache-control":"private, max-age=0",
              "x-content-type-options":"nosniff",
              "x-frame-options":"SAMEORIGIN",
              "x-xss-protection":"1; mode=block",
              "content-length":"0",
              "server":"GSE",
              "alt-svc":"quic=:443; ma=2592000; v=39,38,37,36,35",
              "connection":"close"
            }
        }
    ]
  }
]

This header here suggests that maybe there's a TTL of 30 days?
"alt-svc":"quic=:443; ma=2592000; v=39,38,37,36,35",

@marco-c
Copy link
Member

marco-c commented Jun 30, 2017

The TTL is the TTL header, so it's 7200 in your request.

@marco-c
Copy link
Member

marco-c commented Feb 14, 2018

@sathio did you file a bug on crbug.com?

@kevinr89
Copy link

kevinr89 commented May 8, 2018

Hi. Any news for this?

@debashishkumar
Copy link

Not yet

@jacklbraze
Copy link

hey all, i'm also seeing issues with this! have you guys got any example scenarios of when this is failing? did anyone file a bug yet @sathio ?? if not, i will!

@somanathreddy
Copy link

somanathreddy commented Aug 1, 2019

I am also seeing issues with the TTL across different browsers (Chrome 76/75, Firefox 67/66) now.
@marco-c / @gauntface Do you think this is a Chrome issue as this is being observed in the Firefox browser as well?
@jacklbraze did you file a bug on this? If yes, can you link it here?

@somanathreddy
Copy link

I contacted the FCM team as well regarding this issue, FCM Support team has acknowledged that they are aware of this issue and are working on a fix for it. And so I think we can close this ticket.

More details here

@renegadeHomie
Copy link
Contributor

In reference to #491 which is a duplicate of this, I wish to point that the fact that a value of ZERO for TTL in options object not being honoured is due to this line of code. This if condition will always fail for a ZERO TTL and fallback to the DEFAULT_TTL of 4 weeks.

if (options.TTL) {

Request you to explain if this is expected behaviour.

@marco-c
Copy link
Member

marco-c commented Aug 9, 2019

Oh, thanks for noticing that, so #491 is not a duplicate then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants