Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: increase the HttpAgent socket timeout #1553

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading