Push API servers return 400 Bad Request "Missing TTL header"

RESOLVED FIXED

Status

()

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: collimarco91, Assigned: lina)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: dom-triaged, URL)

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9

Steps to reproduce:

When you POST a notification, Mozilla Push API servers started to return:

400 Bad Request
{"errno": 111, "message": "Missing TTL header", "code": 400, "error": "Bad Request"}"

This is totally undocumented and breaks notification sending. What are you referring to? HTTP TTL or notification TTL? Please help and provide documentation


Actual results:

400 Bad Request
{"errno": 111, "message": "Missing TTL header", "code": 400, "error": "Bad Request"}"



Expected results:

200 or 202 code were expected

If a new TTL header is really required please document it.

Updated

3 years ago
Component: Untriaged → DOM: Push Notifications
Product: Firefox → Core
(Assignee)

Comment 1

3 years ago
I'm very sorry for the way we handled this. We're working on a blog post to warn developers about the change, and clarify why it's necessary. We're also discussing how to communicate backward-incompatibilities like this in the future.

To answer your question: `TTL` is an HTTP header that you include in the `POST` request to indicate how long (in seconds) the message should be stored if the recipient is offline. :marco's Node library defaults to four weeks, which I think is reasonable: https://github.com/marco-c/web-push/blob/68a4d90dfe2723f98f356355b1564aa3b63becd8/index.js#L100

Previously, the default behavior was to assume `TTL: 0` if you didn't specify it. This meant that messages would be dropped on the floor if the browser was closed (or the computer went to sleep)...but it wasn't obvious that this was the case.

I'll close this issue with a link to the post, once it's ready.
Assignee: nobody → kcambridge
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Whiteboard: dom-triaged
(Assignee)

Comment 2

3 years ago
Here's the post: https://blog.mozilla.org/services/2016/02/20/webpushs-new-requirement-ttl-header

Thanks for taking the time to file this bug.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
(Reporter)

Comment 3

3 years ago
Thanks for the clarification. Please note that if you pass a date (e.g. "2016-02-20 15:23:34 +0100") you get no error.
(Assignee)

Updated

3 years ago
Blocks: 1250547
You need to log in before you can comment on or make changes to this bug.