Treat response.text() as a promise in error handling. #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We recently added some better exception handling but unfortunately printing the response body isn't working because
response.text()
is a Promise. The message looks like this:ThriftRequestError: Thrift request failed: HTTP 503 Service Unavailable: [object Promise]
The fix is to use
.then()
to get the body.I have not tested this. I did run
npm run test
and some of the tests pass, but 75 out of 108 thrift-integration tests fail. I'm seeing this error a lot:I think it also might have been happening before this change. It looks unrelated. It seems like it's happening because Hapi listens on 127.0.0.1 and Node v17 and higher stopped forcing IPv64addresses to be listed first when resolving domains so now IPv6 addresses can be returned first. I'll probably post a separate PR for that, but for now I'd prefer not to block this change.