When sending notifications to iOS users, for some of them I get response status code 400 (BadDeviceToken) or code 410 (Unregistered).
From Apple documentation about \"Ba
If using node-apn
. I found the answers here rather confusing as APN has moved to using tokens which work for either sandbox or production modes. I was also confused because writing a 1 off script to send a notification worked in production.
It wasn't until I started to suspect that my my service wasn't getting process.env.NODE_ENV === 'production'
. So I added that to my startup log message and low and behold my service runner forever
was not getting any environment variables. Because of this, it was trying production device ids on the sandbox url.