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

UnhandledPromiseRejection errors #781

Open
fboucquez opened this issue May 19, 2021 · 3 comments
Open

UnhandledPromiseRejection errors #781

fboucquez opened this issue May 19, 2021 · 3 comments
Labels
P2 Issue A major issue with impact

Comments

@fboucquez
Copy link
Contributor

When a fetch call fails, nodejs raises a warning:

UnhandledPromiseRejection: 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(). The promise rejected with the reason "#".

https://github.com/nemgrouplimited/symbol-node-rewards/issues/253
fboucquez/symbol-bootstrap#176

@fboucquez fboucquez added the P2 Issue A major issue with impact label May 19, 2021
@yilmazbahadir
Copy link
Contributor

I can catch a promise rejection and manage the exception but still got the warning with "symbol-sdk": "^1.0.0-alpha-202105211327". I think the original promise rejection in the SDK hasn't been caught.

2021-05-21T21:43:04.554Z warn: [NodeService.ts]     There has been an error talking to known repo http://ec2-44-242-153-48.us-west-2.compute.amazonaws.com:3000/. Error: {"statusCode":404,"statusMessage":"Not}
Unhandled Rejection at: Promise Promise {
  <rejected> Response {
    size: 0,
    timeout: 0,
    [Symbol(Body internals)]: { body: [PassThrough], disturbed: false, error: null },
    [Symbol(Response internals)]: {
      url: 'http://ec2-44-242-153-48.us-west-2.compute.amazonaws.com:3000//node/info',
      status: 404,
      statusText: 'Not Found',
      headers: [Headers],
      counter: 0
    }
  }
} reason: Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: PassThrough {
      _readableState: [ReadableState],
      readable: true,
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: true,
      _transformState: [Object],
      [Symbol(kCapture)]: false
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'http://ec2-44-242-153-48.us-west-2.compute.amazonaws.com:3000//node/info',
    status: 404,
    statusText: 'Not Found',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}

@zhjjj
Copy link

zhjjj commented Jun 8, 2021

I've got the same problem.
When I tried to announce an transaction to the api 'http://ngl-dual-001.symbolblockchain.io:3000', my process crashed.
I found an error was throw from here. If I subscribed the announce result in TransactionService.ts, the error can be caught and no crash occurs.
The error should have been thrown before the connection established, which is {"statusCode":503,"statusMessage":"Service Unavailable","body":"{"code":"ServiceUnavailable","message":"connection failed"}"}

So please help to fix this issue~

@fboucquez
Copy link
Contributor Author

fboucquez commented Jun 8, 2021

Awsome finding @zhjjj , I've created the PR #795 @rg911

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Issue A major issue with impact
Projects
None yet
Development

No branches or pull requests

3 participants