Skip to content

Commit 86746a8

Browse files
committed
feat: increase the HttpAgent socket timeout
1 parent 1408c87 commit 86746a8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/cold-peas-rush.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vue-storefront/magento-api": minor
3+
---
4+
5+
** [CHANGED] ** - increase the HttpAgent socket timeout from `10s` to `30s` to prevent timeout errors on slow connections.

packages/api-client/src/helpers/magentoLink/graphQl.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import possibleTypes from "../../types/possibleTypes.json";
1111
import standardURL from "../url/standardURL";
1212

1313
const { HttpsAgent } = AgentKeepAlive;
14-
const agent = new HttpsAgent();
14+
const agent = new HttpsAgent({
15+
timeout: 30000,
16+
});
1517

1618
const createErrorHandler = () =>
1719
onError(({ graphQLErrors, networkError }) => {
@@ -48,7 +50,7 @@ export const apolloLinkFactory = (
4850
) => {
4951
const baseLink =
5052
handlers?.apolloLink ||
51-
setContext((apolloReq, { headers }) => ({
53+
setContext((_apolloReq, { headers }) => ({
5254
headers: {
5355
...headers,
5456
},

0 commit comments

Comments
 (0)