Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apn write failed: The pending stream has been canceled (caused by: ) #215

Open
rahulss-ksolves opened this issue Sep 10, 2024 · 0 comments

Comments

@rahulss-ksolves
Copy link

I am encountering an error when using the latest version of the node-pushnotifications library for sending push notifications via APNs.

[ { regId: '3d03d9ccdd47d07133e12e1ef455dbb6109d2bb7e928ed5ba98e13a887c4d953', error: VError: apn write failed: The pending stream has been canceled (caused by: ) at ClientHttp2Stream.<anonymous> (/var/www/html/project-dev/api/node_modules/@parse/node-apn/lib/client.js:276:19) at ClientHttp2Stream.emit (node:events:518:28) at emitErrorNT (node:internal/streams/destroy:169:8) at emitErrorCloseNT (node:internal/streams/destroy:128:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { jse_shortmsg: 'apn write failed', jse_cause: [Error], jse_info: {}, cause: [Function: ve_cause] }, errorMsg: 'apn write failed: The pending stream has been canceled (caused by: )' } ]

Steps to Reproduce:

  1. Use the latest node-pushnotifications library.
  2. Attempt to send a push notification to an iOS device using a valid regId.
  3. Observe the error returned.

Additional Information:

  1. Node.js version: [v18.20.0]
  2. node-pushnotifications version: [3.1.1]
  3. Configuration -
const iosSettings = {
            apn: {
                token: {
                    key: fs.readFileSync(GLOBALS.P8_CERTIFICATE_NAME),
                    keyId: GLOBALS.KEY_ID,
                    teamId: GLOBALS.TEAM_ID,
                },
                production: false,
            },
        };
const push = new PushNotifications(iosSettings);
push.send(tokens, data, async (err, result) => {
    if (err) {
        console.error('Error sending push notification: ', err);
        
    } else {
        console.log(result[0].message);
    }
});

It appears that the error occurs when the APNs stream is canceled for some reason. The jse_shortmsg indicates apn write failed, and the jse_cause points to an [Error], but there is no further information on the underlying cause.

Would appreciate any guidance or insights on what might be causing this issue and how it can be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant