rs/pushd

Apple Notice of End of Push Binary Support

jamescahall opened this issue · 7 comments

This notice was received today:
"The HTTP/2‑based Apple Push Notification service (APNs) provider API lets you take advantage of great features, such as authentication with a JSON Web Token, improved error messaging, and per‑notification feedback. If you still send push notifications with the legacy binary protocol, make sure to upgrade to the APNs provider API as soon as possible. APNs will no longer support the legacy binary protocol after March 31, 2021. "

It is unclear if PushD already uses the more modern HTTP/2 protocols or not. Can this please be confirmed? I see this uses the APN library which does support HTTP/2 in its most modern implementation but unclear if PushD has been adapted to use the latest versions of that library.

Hello, i would like to ask you?
Can we still using this Push D discharging Apple resource?

hb020 commented

but unclear if PushD has been adapted to use the latest versions of that library.

My interpretation is: NO. But it is not hard to migrate.

Some more detail:

pushd uses apn, which is supposed to be compatible with HTTP/2. From what I see, the code is made for version 1.7 of that library, but I'm not sure if that version is compatible with HTTP/2. A migration is probably in order (it would be safe anyway). See What's new in v2.0 on what needs to be changed.

Note that some people that have forked this, have moved to the later version, among which https://github.com/mdholloway/pushd/

[edit]: the above fork is listed as supporting the new methods, but in reality does not, it still uses the old interface.

Is this something you can work on? I reviewed the fork for mdholloway and it has been re-written in JS instead of Coffee which would require a larger migration as we have 120 deployment settings.

hb020 commented

I will look in to it. It depends a bit on the used OS though. It is likely that the new lib requires some other changes.

hb020 commented

Done. See my fork.
The mdholloway fork did not support the latest version of the apns lib.

Changes:

  • made HTTP/2 APNS possible via @parse/node-apn (most others do not seem maintained anymore)
  • added support for badges under Android
  • added explanation on support for the 2 different apns authentication methods: certificate or token
  • adapted the doc a bit
  • allowed the caller to be IPv4, but announced as IPv6.
  • included all the other the work from mdholloway.

Sorry. Have not been able to keep it under coffeescript, as the apn module threw a syntax error. Tried various node versions, but nogo. Now I'm not a node expert, so I took the easy way out by building upon mdholloway's fork.

I have tested it under node v11.15.0. Lower versions may very well have problems. From the various other packages used I guess you will need v8.x.x at least.
You will need gcc 4.9 or more when installing. If your OS does not have it, you may find it under backports.

NOT DONE YET (at the time of writing):
Work on the root cert, that will also come end if this month. See the related issue on parse-community/node-apn. It is likely something that you have to do outside of this package.

Thanks! As for the root cert, it sounds like this just needs to be run using Node v12.13.0+ and . It is not clear if there is anything else required. We've never bundled a root cert with this project and simply uses PEM files for Apple and API keys for Google.

NOTE: I have Node 12.16.3 installed and getting this error on your fork on npm install:

hiredis@0.5.0 install /Users/jamescahall/Downloads/pushd-master_hb020/node_modules/hiredis
node-gyp rebuild

CC(target) Release/obj.target/hiredis-c/deps/hiredis/sds.o
CC(target) Release/obj.target/hiredis-c/deps/hiredis/read.o
LIBTOOL-STATIC Release/hiredis-c.a
CXX(target) Release/obj.target/hiredis/src/hiredis.o
CXX(target) Release/obj.target/hiredis/src/reader.o
../src/reader.cc:21:17: warning: 'Set' is deprecated: Use maybe version
[-Wdeprecated-declarations]
larray->Set(task->idx,v);
^
/Users/jamescahall/Library/Caches/node-gyp/12.16.3/include/node/v8.h:3507:3: note:
'Set' has been explicitly marked deprecated here
V8_DEPRECATED("Use maybe version",
^
/Users/jamescahall/Library/Caches/node-gyp/12.16.3/include/node/v8config.h:328:29: note:
expanded from macro 'V8_DEPRECATED'
declarator attribute((deprecated(message)))
^
../src/reader.cc:55:33: error: no matching member function for call to
'ToString'
v = Exception::Error(v->ToString());
~~~^~~~~~~~
/Users/jamescahall/Library/Caches/node-gyp/12.16.3/include/node/v8.h:2668:44: note:
candidate function not viable: requires single argument 'context', but no
arguments were provided
V8_WARN_UNUSED_RESULT MaybeLocal ToString(
^
/Users/jamescahall/Library/Caches/node-gyp/12.16.3/include/node/v8.h:2684:31: note:
candidate function not viable: requires single argument 'isolate', but no
arguments were provided
Local ToString(Isolate* isolate) const);
^
1 warning and 1 error generated.
make: *** [Release/obj.target/hiredis/src/reader.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/jamescahall/.nodebrew/node/v12.16.3/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/Users/jamescahall/.nodebrew/node/v12.16.3/bin/node" "/Users/jamescahall/.nodebrew/node/v12.16.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jamescahall/Downloads/pushd-master_hb020/node_modules/hiredis
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN pushd@1.6.6 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hiredis@0.5.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hiredis@0.5.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jamescahall/.npm/_logs/2021-03-07T00_50_57_278Z-debug.log

hb020 commented

Sorry, in my case I cannot go above node 11, and when on 11, on my OS, I do not have that error. Of course, best would be to go all the way up to the latest OS, node and package versions, but not everybody can do that.

By the way, from what I understand, v11.15.0 will also work with the new root cert, as https://github.com/nodejs/node/blob/v11.15.0/src/node_root_certs.h#L247 shows. See post parse-community/node-apn#49 (comment) on how to check that for your node version.