RocketChat / RocketChat/Rocket.Chat

Push Notifications: Development not working

Open
#30,829 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

When developing an own whitelabeled App and trying to activate push notifications via APN in development mode not working.

Using a production iOS-App with a production APN device token (for example TestFlight) works fine!

Steps to reproduce:
  1. generate APN (production and development) Certificates and copy to the APN formula in settings
  2. disable production mode
  3. on restart: there is an error certificate does not support configured environment, production: true and APN isn't initialized

I tried to console.log the certificate and the environment informations in /app/bundle/programs/server/npm/node_modules/apn/lib/credentials/certificate/validate.js:

environment = { sandbox: true, production: false }
credentials = { [...], production: true }

so the credentials.production is always true, independant of the switch.

Instead setting the EndpointAddress.production in /app/bundle/programs/server/npm/node_modules/apn/lib/config.js manually to api.development.push.apple.com works.

Expected behavior:

Setting correctly to APN development mode when disabling production.

Actual behavior:

APN development not set correctly

Server Setup Information:
  • Version of Rocket.Chat Server: 6.4.4
  • Operating System: debian
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: enabled
  • NodeJS Version: 14.21.3
  • MongoDB Version: 5.0.22

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with production mode disabled, then inspect the APN integration and the referenced files /app/bundle/programs/server/npm/node_modules/apn/lib/credentials/certificate/validate.js and apn/lib/config.js. Compare the configured environment with the certificate values; done means development APN initialization succeeds without the certificate-environment error and production mode still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
backend, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.