aquipa / node-pushnotifications-http2

Push notifications for GCM, APNS, MPNS, AMZ (automatic detection from device token)
MIT License
1 stars 0 forks source link

Missing Topic #6

Closed Peh4 closed 4 years ago

Peh4 commented 5 years ago

Hello I has memory leaks with appfeel/node-pushnotifications so i only switched to node-pushnotifications-http2 and upgraded node to 8.8.1

I have now this error :

rror: Error: MissingTopic
    at forEach.failure (/home/peha/socket-chat-server/node_modules/node-pushnotifications-http2/lib/sendAPN.js:88:76)
    at Array.forEach (<anonymous>)
    at connection.send.then.response (/home/peha/socket-chat-server/node_modules/node-pushnotifications-http2/lib/sendAPN.js:73:37)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7),
       errorMsg: 'MissingTopic' } ] }

the topic is set in my notification object, as it was before i don't hunderstand

jpike88 commented 5 years ago

My object looks like this:

const push = new PushNotifications({
    gcm: {
        id: config.gcm.key,
        phonegap: true
    },
    apn: {
        token: {
            key: certificates.apn,
            keyId: config.apn.keyId,
            teamId: config.apn.teamId
        },
        production: (config.env === 'production'),
        hideExperimentalHttp2Warning: true
    },
});

const data = {
            custom: event.metadata,
            title: subject,
            body,
            topic: config.gcm.topic
};
await core.push.send(registrationIDs, data);

Works fine for me. I'd suggest mirroring the above code. I don't know too many details beyond that, I did the minimum to make it work with native http2 and not much else

sergio5405 commented 5 years ago

+1 Same issue here

Peh4 commented 5 years ago

Can you please let the issue open, if someone want to share a solution ?