What are the possible reasons to get APNs responses BadDeviceToken or Unregistered?

前端 未结 6 1570
离开以前
离开以前 2021-02-01 14:38

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

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 15:18

    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.

提交回复
热议问题