hirosystems / stacks-blockchain-api

API for the Stacks blockchain
https://stacks-blockchain-api.vercel.app
GNU General Public License v3.0
170 stars 107 forks source link

Failed to connect to PG instance: EAI_AGAIN #1426

Closed CharlieC3 closed 1 year ago

CharlieC3 commented 1 year ago

When there are short, transient DNS lookup failures, the API will fail to find the postgres database. When this happens, the API crashes. Instead, it should retry the connection continuously until it works again.

{"level":"error","message":"Cannot connect to pg getaddrinfo EAI_AGAIN mainnet-postgresql-blue-all","stack":"Error: getaddrinfo EAI_AGAIN mainnet-postgresql-blue-all\n    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)\n    at cachedError (/app/node_modules/postgres ││ /cjs/src/query.js:166:23)\n    at new Query (/app/node_modules/postgres/cjs/src/query.js:36:24)\n    at sql (/app/node_modules/postgres/cjs/src/index.js:105:11)\n    at connectPostgres (/app/src/datastore/connection.ts:87:20)","timestamp":"2022-11-09T03:17:37.422Z"}                                               ││ stacks-blockchain-api-reader {"level":"error","message":"app failed to start: Error: getaddrinfo EAI_AGAIN mainnet-postgresql-blue-all getaddrinfo EAI_AGAIN mainnet-postgresql-blue-all","stack":"Error: getaddrinfo EAI_AGAIN mainnet-postgresql-blue-all\n    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dn ││ s:109:26)\n    at cachedError (/app/node_modules/postgres/cjs/src/query.js:166:23)\n    at new Query (/app/node_modules/postgres/cjs/src/query.js:36:24)\n    at sql (/app/node_modules/postgres/cjs/src/index.js:105:11)\n    at connectPostgres (/app/src/datastore/connection.ts:87:20)","timestamp":"2022-11-09T03:1 ││ 7:37.426Z"}
blockstack-devops commented 1 year ago

:tada: This issue has been resolved in version 6.2.0-beta.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

blockstack-devops commented 1 year ago

:tada: This issue has been resolved in version 6.2.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

blockstack-devops commented 1 year ago

:tada: This issue has been resolved in version 7.0.0-stacks-2.1.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: