Sometimes when using node-steamapi, a network error will crash the entire node.js process:
events.js:292
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND api.steampowered.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)
Emitted 'error' event on ClientRequest instance at:
at TLSSocket.socketErrorListener (_http_client.js:432:9)
at TLSSocket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:84:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'api.steampowered.com'
}
We have the following Express route which uses node-steamapi. It takes a valid steam id as a query parameter, calls steam.resolve, then uses steam.getUserSummary and replies back with json containing the summary. Wrapping the code in a try...catch block doesn't help.
Example request: http://localhost:3000/summary?id=76561197989862681
router.get('/summary', function(req, res) {
// get steam id as query parameters
const pId = steam.resolve(req.query.id)
pId.then((id) => {
// get user summary
const pSummary = steam.getUserSummary(id)
pSummary.then((summary) => {
// return summary data
return res.status(200).json({
status: "success",
data: summary,
})
})
.catch((reason) => {
// error getting user summary
return res.status(404).json({
status: "error",
message: reason.message,
})
})
})
.catch((reason) => {
// error getting user summary
return res.status(404).json({
status: "error",
message: reason.message,
})
})
});
Sometimes when using node-steamapi, a network error will crash the entire node.js process:
We have the following Express route which uses node-steamapi. It takes a valid steam id as a query parameter, calls steam.resolve, then uses steam.getUserSummary and replies back with json containing the summary. Wrapping the code in a try...catch block doesn't help. Example request: http://localhost:3000/summary?id=76561197989862681
cc: @ww2497 @ZacharyCChang0828 @mss6522