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

Unable to change 5 seconds Timeout in the SDK #143

Open
totzk9 opened this issue Oct 30, 2024 · 3 comments
Open

Unable to change 5 seconds Timeout in the SDK #143

totzk9 opened this issue Oct 30, 2024 · 3 comments
Assignees

Comments

@totzk9
Copy link
Contributor

totzk9 commented Oct 30, 2024

The graphql-v5.2.0-beta.9 dependency package being used in nhost-dart SDK added a 5 second timeout which causes Nhost apps to fail abrupty.

graphql-v5.2.0-beta.9 related commit: zino-hofmann/graphql-flutter@6180841

We should add an optional parameter to be able to increase the Timeout in createNhostGraphQLClientForAuth.

Screenshot 2024-10-30 at 4 17 59 PM

@totzk9
Copy link
Contributor Author

totzk9 commented Oct 30, 2024

Currently working on a PR for this.

@dbarrosop
Copy link
Member

Awesome, thanks for the report and for the PR :)

@totzk9
Copy link
Contributor Author

totzk9 commented Nov 1, 2024

For anyone who uses the latest and wants to override the timeout when doing:
dependencies or dependency_overrides in their project

dependency:
  graphql: ^5.2.0-beta.9

You can just create your own createNhostGraphQLClientForAuth function:

import 'package:graphql/client.dart';
import 'package:http/http.dart' as http;
import 'package:nhost_gql_links/nhost_gql_links.dart';
import 'package:nhost_sdk/nhost_sdk.dart';

GraphQLClient createNhostGraphQLClient(
  NhostClientBase nhostClient, {
  Map<String, String>? defaultHeaders,
  http.Client? httpClientOverride,
  GraphQLCache? gqlCache,
  DefaultPolicies? defaultPolicies,
  bool? alwaysRebroadcast,
  DeepEqualsFn? deepEquals,
  bool? deduplicatePollers,
  Duration? queryRequestTimeout,
}) {
  return GraphQLClient(
    link: combinedLinkForNhostAuth(
      nhostClient.gqlEndpointUrl,
      nhostClient.auth,
      defaultHeaders: defaultHeaders,
      httpClientOverride: httpClientOverride,
    ),
    cache: gqlCache ?? GraphQLCache(),
    defaultPolicies: defaultPolicies,
    alwaysRebroadcast: alwaysRebroadcast ?? false,
    deepEquals: deepEquals,
    deduplicatePollers: deduplicatePollers ?? false,
    queryRequestTimeout: queryRequestTimeout ?? const Duration(seconds: 60),
  );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants