Code Monkey home page Code Monkey logo

Comments (15)

TysonAndre avatar TysonAndre commented on August 12, 2024

What's the output of node_modules/.bin/mocha test/client.js with this project?

What version of parse/node-apn is used (e.g. check package-lock.json) - 4.0.0 is the latest?

What node version are you using?

from node-apn.

alexibz avatar alexibz commented on August 12, 2024

What's the output of node_modules/.bin/mocha test/client.js with this project?

I've run npm run test in the directory and I actually have a lot of errors.

What version of parse/node-apn is used (e.g. check package-lock.json) - 4.0.0 is the latest?

package-lock.json has it at 4.0.0

What node version are you using?

node": "12.13.1

from node-apn.

alexibz avatar alexibz commented on August 12, 2024

I also tried with 3.2.0 and I do receive the errors correctly, i.e. status=400, reason=MissingDeviceToken, but the error is triggered after about 60 seconds, no matter the requestTimeout I set. So under 3.2.0 I can reach https://github.com/parse-community/node-apn/blob/master/lib/client.js#L160 the request.on('end')

from node-apn.

TysonAndre avatar TysonAndre commented on August 12, 2024

https://github.com/parse-community/node-apn/runs/1629508878?check_suite_focus=true passes in node v12.20.0 - it also passes for me in v12.18.3 on linux. 12.13.1 also passes when I install and use that with nvm on linux. But maybe it's specific to the https implementation instead of http for unit tests.

Does it work if you upgrade to the latest node 12.20.0+?

I meant if you clone https://github.com/parse-community/node-apn , run npm install, and run npm test - what is the console output

What OS are you using?

How does this affect the application you're using? It should still be calling resolve() in the error

from node-apn.

alexibz avatar alexibz commented on August 12, 2024

I tried to clone and run the tests from an empty project and they all passed successfully. There must be something in my application that is breaking. I have a large application, and also have node-apn v1.7.8 installed for fallback, which might be causing the issue.

I will investigate more and write back here in case someone also encounters this issue. Thank you for the narrowing the problem.

from node-apn.

alexibz avatar alexibz commented on August 12, 2024

In the end, I've opted to downgrade to version 3.2.0 since it seems to work stable, I could not narrow the problem down.

from node-apn.

n72t44 avatar n72t44 commented on August 12, 2024

I had successfully used 4.0.0 on node v10.3.0 for some time and all MissingDeviceToken error messages were received correctly. Now on the same environment (didn't change a bit) I just get VError: stream ended unexpectedly / VError: apn write timeout.
Has Apple APNs changed some timeout parameter or implemented a different policy on the http connection ?

from node-apn.

TysonAndre avatar TysonAndre commented on August 12, 2024

I had successfully used 4.0.0 on node v10.3.0 for some time and all MissingDeviceToken error messages were received correctly. Now on the same environment (didn't change a bit) I just get VError: stream ended unexpectedly / VError: apn write timeout.
Has Apple APNs changed some timeout parameter or implemented a different policy on the http connection ?

What fraction of requests have errors?

No idea what your issue is - I'm surprised at http/2 disconnecting. Are you properly reusing the established connection (i.e. not constantly establishing new connections to APNs, e.g. by starting a lot of node processes or by creating brand new node-apn clients?) - I think establishing too many network connections to APNs may cause them to reject new connections as a potential Denial of Service.

What's the expiry date of your certificate? Do you log the tokens and JSON payloads you're sending to apns - are both of them valid (e.g. no JSON encoding errors, tokens are all representations of token data of the correct length). Is this the right app (e.g. are you using a debug build that should receive pushes from a sandbox apns server with the production apns server?)

Can you establish connections to apns manually for pems (https://github.com/node-apn/node-apn/wiki/Preparing-Certificates) - I forget how to check p8 fils

EDIT: Also, how many requests are you trying to send at a time?

from node-apn.

n72t44 avatar n72t44 commented on August 12, 2024

Hi,
I'm using .p8 key files (never expires) and both tokens and json payloads are valid. I'm testing it in production.
Today with the same code I get no errors. I believe yesterday I raised some conditions for throttling during the tests that the code didn't seem to be able to deal with correctly.

from node-apn.

HardikDG avatar HardikDG commented on August 12, 2024

I am also having the same issue in my demo of node-apn. Can any one help me with it?

Node v:12.16.3
node-apn: 4.0

error: VError: stream ended unexpectedly
        at ClientHttp2Stream.<anonymous> (/Users/hardik.ganjwala/Desktop/push_sample/node_modules/@parse/node-apn/lib/client.js:186:25)
        at ClientHttp2Stream.emit (events.js:310:20)
        at endReadableNT (_stream_readable.js:1187:12)
        at processTicksAndRejections (internal/process/task_queues.js:84:21) {
      jse_shortmsg: 'stream ended unexpectedly',
      jse_info: {}

from node-apn.

TysonAndre avatar TysonAndre commented on August 12, 2024

Enable the logger for your app temporarily (or permanently, if it's low volume for your use case)

DEBUG=apn can be used to set this - node-apn uses the npm debug module https://www.npmjs.com/package/debug

          const error = new VError(e, 'Unexpected error processing APNs response');
          if (logger.enabled) {
            logger(`Unexpected error processing APNs response: ${e.message}`);
          }

from node-apn.

RodolfoGS avatar RodolfoGS commented on August 12, 2024

I'm having the same issue randomly in production. It works 99% of time, but sometimes (a couple of times per day) I'm getting this response. Anyone know what could be happening?

{
    "failed": [
        {
            "device": "7f7400dbf5013a1__hidden__f48de965b94f4cdb41530",
            "error": {
                "jse_shortmsg": "apn write timeout",
                "jse_info": {},
                "message": "apn write timeout"
            }
        }
    ],
    "message": {
        "body": { hidden... },
        "aps": {
            "sound": "default",
            "alert": {
                "body": "hidden...",
                "title": "hidden..."
            }
        }
    }
}

from node-apn.

davimacedo avatar davimacedo commented on August 12, 2024

Have you tried to increase the timeout limit?

from node-apn.

RodolfoGS avatar RodolfoGS commented on August 12, 2024

@davimacedo I'm using the default, I'll update to 10000 ms

from node-apn.

mtrezza avatar mtrezza commented on August 12, 2024

I'm closing this as it does not seem to be a Parse node-apn issue.

  • For help with Parse Platform we recommend our community forum
  • For coding questions we recommend Stack Overflow using the parse-platform tag
  • For network and server questions we recommend ServerFault using the parse-server tag

from node-apn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.