Skip to content

Commit

Permalink
feat: increase the HttpAgent socket timeout (#1553)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszherba authored Nov 20, 2024
1 parent 1408c87 commit a89d1e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-peas-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vue-storefront/magento-api": minor
---

** [CHANGED] ** - increase the HttpAgent socket timeout from `10s` to `30s` to prevent timeout errors on slow connections.
6 changes: 4 additions & 2 deletions packages/api-client/src/helpers/magentoLink/graphQl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import possibleTypes from "../../types/possibleTypes.json";
import standardURL from "../url/standardURL";

const { HttpsAgent } = AgentKeepAlive;
const agent = new HttpsAgent();
const agent = new HttpsAgent({
timeout: 30000,
});

const createErrorHandler = () =>
onError(({ graphQLErrors, networkError }) => {
Expand Down Expand Up @@ -48,7 +50,7 @@ export const apolloLinkFactory = (
) => {
const baseLink =
handlers?.apolloLink ||
setContext((apolloReq, { headers }) => ({
setContext((_apolloReq, { headers }) => ({
headers: {
...headers,
},
Expand Down

0 comments on commit a89d1e1

Please sign in to comment.