Unable to receive Push Notifications

Hello,

After configuring the Portainer with the given Push Notif token we were unable to receive any push notifications on the iOS phone?

Below are our survey and Stack screenshots. Could you kindly help?

Please change SCHEDULER=off to SCHEDULER=on in the environment section of your docker-compose.yml file.

Furthermore – after investigating, it looks like our developers pushed an internal update to there server that requires Redis for push notifications. Will you be able to launch a Redis instance and connect it to verify that things work or does your organizational policy forbid that?

Thanks @avaidyam. After changing the SCHEDULER=on I kept getting the following error, I think this is something related to REDIS… Should we install Redis on the Virtual Machine and change something in the YML file? Could you please elaborate? I couldn’t find anything related to Redis setup in this doc https://docs.lamp.digital/9550a87b186f4f3db60e1858f4c2f346

Yes - this looks like Redis complaining. Our developers are using Redis temporarily to manage notification scheduling (due to some critical bugs) before switching to a message queue called NATS later this month.

I believe all you have to do is add a Redis service (e.g. named message_queue) to your docker-compose.yml and add the environment variable REDIS_HOST=redis://message_queue:6379/0 to the LAMP-server service. Let me get some more detailed information on configuring Redis for mindLAMP from our developers and get back to you soon! A pretty simple example for the Redis service definition would be:

  message_queue:
    image: redis

Hi @avaidyam

I tried to follow the updated installation instructions for Push Notifications on the Deployment guide https://docs.lamp.digital/9550a87b186f4f3db60e1858f4c2f346 and updated our Stack (YML file) but I think somewhere it’s throwing error and we’re unable to receive push notifications even after allowing Push Notification in the settings and reinstalling the mobile app on iOS.

Do we need to update both the REDIS and NATS as instructed in the above guide? I tried both and also updated only REDIS… Lastly, should we turn on -SCHEDULER=on ?

-REDIS_HOST: 'redis://cache:6379/0'

The below is the REDIS container LOGS

This is the LAMP server throwing UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379

When I removed the Scheduler=ON from the stack I receive the following in the Lamp server logs

Database verification complete.

  • Running with schedulers disabled.*

Initialization complete.

GET / 200 - 10.095 ms

GET /type/a9zbfnbppszr5zc3qcfj/attachment/lamp.messaging 404 - 84.306 ms

GET /favicon.ico - - - ms

GET /type/a9zbfnbppszr5zc3qcfj/attachment/lamp.messaging 404 - 40.870 ms

GET /type/a9zbfnbppszr5zc3qcfj/attachment/lamp.messaging 404 - 49.804 ms

Thank you in advance!

@kkadapa

  1. Yes, you need to include both REDIS_HOST and NATS_SERVER as they are both required.
  2. SCHEDULER=on is also required. If you remove this, you are telling the API server “I do not need to schedule activities for notifications.”
  3. It looks like you may need to ensure the networking between your containers in the docker-compose.yml file is correct. (i.e. Can the API server actually ping/communicate with cache or nats?)

Thank you @avaidyam!

I tried to EXEC into the REDIS container and did Ping and got PONG as a response which guarantees that Redis is working but the LAMP Server is throwing the below error, the following is my Stack file in Portainer (docker-compose.YML)

image

@kkadapa You should be executing the ping/pong from the LAMP container to verify that it is actually able to see the Redis container. If you do that from within Redis, it wouldn’t help since localhost to localhost connections will always succeed. Please make sure you’re using the latest images for your containers (we’ve updated our documentation) as well.

Thank you @avaidyam. Finally after changing network settings in the docker-compose.yml file the error went away but the Push Notifications are not appearing on the iPhone and I see the following in the Server Logs…

Also, Just FYI… None of the hyperlinks under Content are working… https://docs.lamp.digital/

@kkadapa, thanks for letting us know — the docs issue should be fixed now. Your logs indicate: Error encountered on sending APN push notification — is your API Key added to the environment variables correctly? Furthermore, after consulting with our developers it looks like there was a mistake in the code. The PUSH_API_GATEWAY variable was supposed to be of the format app-gateway.lamp.digital but instead must be https://app-gateway.lamp.digital/push until the issue is resolved. (Please note the /push at the end.)

Our apologies — and hope this helps get you started with notifications.

Thank you @avaidyam

I changed the PUSH_API_GATEWAY but I’m still receiving Error encountered sending APN push notification. error… I also emailed you our Push Notification Key sent by Rebecca

   - PUSH_API_GATEWAY=https://app-gateway.lamp.digital/push
   - PUSH_API_KEY=$$$$$$

image

1 Like

It looks like you’re experiencing the same issue as described in this GitHub issue. Could you make a comment with your logs attached (as text instead of a screenshot)? Our developers are looking into it.

Sure @avaidyam. Just commented.

Thanks!

1 Like

Hi @kkadapa
i tried to enable push notification in our self hosted platform but we have the same problem as you.
ECONREFUSED 127.0.0.1:6379.
How did you solve? Can you share your configuration?

Thanks in advance
marco

Hi @avaidyam,
can you help me with this error?

  (node:1) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379

i tried to load new configuration from documentation with no success. When i enable schedule this error block the lamp container.
here my configuration

version: '3.7'
services:
  server:
    image: 'lamp-server:latest'
    environment:
     - HTTPS=off
     - CDB=
     - DB_KEY=
     - ROOT_KEY=
     - SCHEDULER=off
     - PUSH_API_GATEWAY='
     - PUSH_API_KEY=''
     - REDIS_HOST= 'redis://cache:6379/0'
     - NATS_SERVER= 'message_queue:4222'
    networks:
      - public
    deploy:
      mode: replicated
      labels:
        traefik.enable: 'true'
        traefik.http.routers.lamp_server.entryPoints: 'websecure'
        traefik.http.routers.lamp_server.rule: 'Host(`thinksharpapi.angelinipharma.com`)'
        traefik.http.routers.lamp_server.tls.certresolver: 'default'
        traefik.http.services.lamp_server.loadbalancer.server.port: 3000
      placement:
        constraints:
          - node.role == manager
  database:
    image: apache/couchdb:latest
    volumes:
      - /home/ec2-user/data/couchdb:/opt/couchdb/data
    networks:
      - public
    environment:
      - COUCHDB_USER=
      - COUCHDB_PASSWORD=
    deploy:
      mode: replicated
      labels:
        traefik.enable: 'true'
        traefik.http.routers.lamp_db.entryPoints: 'websecure'
        traefik.http.routers.lamp_db.rule: 'Host(`thinksharpdb.angelinipharma.com`)'
        traefik.http.routers.lamp_db.tls.certresolver: 'default'
        traefik.http.services.lamp_db.loadbalancer.server.port: 5984
      placement:
        constraints:
          - node.role == manager
  app-gateway:
    image: 'bidmcdigitalpsychiatry/lamp-app-gateway:latest'
    environment:
      APNS_P8: ""
      APNS_AUTH: ""
      API_KEYS: ""
    networks:
      - public
    deploy:
      mode: replicated
      labels:
        traefik.enable: 'true'
        traefik.http.routers.lamp_app_gateway.entryPoints: 'web'
        traefik.http.routers.lamp_app_gateway.rule: 'Host(`app-gateway.webhop.net`)'
        traefik.http.services.lamp_app_gateway.loadbalancer.server.port: 3000
  cache:
    image: redis:6.0.8-alpine
    healthcheck:
      test: redis-cli ping
    networks:
      - public
    deploy:
      mode: replicated
      update_config:
        order: stop-first
        failure_action: rollback
      placement:
        constraints:
          - node.role == manager
  message_queue:
    image: nats:2.1.9-alpine3.12
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:8222/varz || exit 1
    networks:
      - public
    deploy:
      mode: replicated
      update_config:
        order: start-first
        failure_action: rollback
      placement:
        constraints:
          - node.role == manager
networks:
  public:
    external: true
volumes:
  database:
  legacydb:
1 Like

@mpagnanelli If you don’t mind, could you make a new GitHub issue for this as it’s a development/deployment-related question? Myself or our development team can respond quickly there.

Hi Aditya, I am also having the same problem,

We need Push notification functionality, Do I need to deploy lamp-app-gateway image?

Once I changed followings environment settings:
SCHEDULER: ‘on’
PUSH_API_GATEWAY: ‘https://app-gateway.lamp.digital/push

getting below error and Container is not starting. Let me know if you find a solution to this issue.

    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 10)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 12)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 13)


(node:1) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT


    at Socket.<anonymous> (/usr/src/app/node_modules/ioredis/built/redis/index.js:285:37)


    at Object.onceWrapper (events.js:421:28)


    at Socket.emit (events.js:315:20)


    at Socket._onTimeout (net.js:483:8)


    at listOnTimeout (internal/timers.js:554:17)


    at processTimers (internal/timers.js:497:7)


(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 14)


ActivitySpec database online.


SensorSpec database online.


Researcher database online.


Study database online.


Participant database online.


Activity database online.


Sensor database online.


ActivityEvent database online.


SensorEvent database online.


Credential database online.


Tag database online.

Database verification complete.

Server routing initialized.

Clean all queues…

CLEANING ALL QUEUE

(node:1) UnhandledPromiseRejectionWarning: Error: getaddrinfo EAI_AGAIN cache

  at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)

(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see Command-line options | Node.js v15.8.0 Documentation). (rejection id: 15)

HI @mpagnanelli

Sorry for the tardy response. The following is our configuration…

version: ‘3.7’
services:
server:
image: ‘bidmcdigitalpsychiatry/lamp-server:2021’
environment:
- HTTPS=off
- SCHEDULER=on
- ROOT_KEY=xxxx
- CDB=http://admin:xxxx@database:5984/
- APP_GATEWAY=app-gateway.lamp.digital
- PUSH_API_KEY=xxxx
- REDIS_HOST=redis://cache:6379/0
- NATS_SERVER=message_queue:4222
networks:
- public
- private
expose:
- “3000”
ports:
- “3000:3000”

1 Like

@kkadapa, Thanks for sharing your configuration, I see you have private network listed in LAMP-Server.

Do you mind sharing, what was the command you have used to setup private network.
Here is the command I have used to setup public network:
docker network create --driver overlay --attachable public

1 Like