Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Throws an exception even if it sends of the notification #48

Open
vongohren opened this issue Feb 10, 2019 · 14 comments
Open

Throws an exception even if it sends of the notification #48

vongohren opened this issue Feb 10, 2019 · 14 comments

Comments

@vongohren
Copy link

Describe the bug
I call the method pushTransport like this

  const pushTransport = transport.push.send(pushToken, pubEncKey);
  pushTransport(verification);

And all is good the notification comes to the user, but for some reason, it throws an error aswell, see screenshot. I get unhandled rejection, because I dont have a try catch on this. But will add it now

To Reproduce
Just run this lib with this feature.
Im sending of a VC so the subject is set.

Expected behavior
I expect the error not to come.

Screenshots
screenshot 2019-02-10 at 16 08 19

Desktop (please complete the following information):
Node.js - 9.10.0
"uport-transports": "0.2.2"

@vongohren
Copy link
Author

vongohren commented Feb 10, 2019

For info, there was no try catch that could handle this error for me, because I dont await the procedure. But according to the examples, await should no be nessecary?

I tried out with await and the error was caught. But the notification is still sent.
I will keep on logging these errors forward, and hope you will fix it soon :D

@vongohren
Copy link
Author

A second update, I just tried with another identity which was just newly connected, and then I did not get that error. Maybe it has something to do with that the token might have expired, because I have seen that before, and maybe something about the server not responding the right thing back.

But it is still weird that the service still delivers the VC to the mobile, to the mobile that got the error, not the other one.

@vongohren
Copy link
Author

I keep getting strange errors from the library, maybe the service is acting up?

screenshot 2019-02-11 at 08 57 14

@vongohren
Copy link
Author

So the main problem is that I dont get the core error message. So I dont know what the mistake is. It would be great to know what the error is, because it might be outdated push token

@vongohren
Copy link
Author

Latest update, the endpoint is disabled?

screenshot 2019-02-20 at 10 58 36

@ajunge
Copy link
Contributor

ajunge commented Feb 20, 2019

Hi. Do you know which endpoint is hitting?

@vongohren
Copy link
Author

vongohren commented Feb 20, 2019

@ajunge it seems to be hitting "https://api.uport.me/pututu/sns"

But to update, because of this error, I am not getting the pushes anymore. So the initial issue has gone from ish working, to not working. But the problem of not reporting the right problem back to the user is still there.

The res in this situation is 500 so it will reach the line:
reject(new Error('Error sending push notification to user: ' + res.statusCode + ' ' + body.toString()));
And then body.toString() returns "[object Object]", not what is intended to recieve.

screenshot 2019-02-20 at 13 59 12

@vongohren
Copy link
Author

@ajunge did you figure out anything in regards to this?

@vongohren
Copy link
Author

@ajunge this works better now, thanks
But there is still a problem with the error reporting, that toString is not a proper way to return a message.
Maybe @mi-xu can have a look at that.

@vongohren
Copy link
Author

This is still a problem, because I cannot see why the uPort situation fails, because of the body.toString() method. It returns object Object. @mi-xu @rmw2

@vongohren
Copy link
Author

What is the process of this? We are getting this error multiple times and I need to understand what the error is and not just 500 [Object object]

@localredhead
Copy link
Contributor

@vongohren We are monitoring to discover the root cause. In the screenshot's provided we can see the body of an error message stating "Endpoint is Disabled" .

We know the endpoint is being automatically disabled due to an invalid token (for some reason). As you noted previously a new ID did not have the issue - so we think you are correct about the token being part of the problem.

We have identified improvements that we will make to fix this, but it will take some time. If you request a new push token for the affected users - does it resolve the issue in the short term?

@localredhead
Copy link
Contributor

@vongohren we have pushed an alpha version of the library that will print the object's message if there is one.
https://www.npmjs.com/package/uport-transports/v/0.2.5-alpha.0

@vongohren
Copy link
Author

So it have been back and forth, one point it was down as Andres fixed it. But the first problem is that I can't report back as the main problem is object object, on our dev and prod servers. But I will test out that alpha and give an insight to what the problem can be. We have experienced that the token has been out of date, but back in the days, we got the message. I will see what messages we get the most

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

No branches or pull requests

3 participants