eventuate-clients / eventuate-client-nodejs

Other
4 stars 3 forks source link

EventuateClient.js assumes HTTP response is JSON #43

Closed cer closed 7 years ago

cer commented 7 years ago

This might not be a good idea. For example, a load balancer, which we have no control over, might detect an error and return a 5xx for example.

/cc @dartvandru

cer commented 7 years ago

Got this error

[2017-07-27 02:49:11.408] [ERROR] AggregateRepository - Create entity failed: AccountEmailAddress
Retry 1
SyntaxError: Unexpected token b in JSON at position 0
    at Object.parse (native)
    at IncomingMessage.<anonymous> (/app/node_modules/@eventuateinc/eventuate-nodejs-client/dist/modules/EventuateClient.js:764:34)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

This is happening because the API gateway is return 503 with a body of "busy"

dartvandru commented 7 years ago

Resolved with: https://github.com/eventuateinc/eventuate-nodejs-client/pull/42