Skip to content

Conversation

@westhechiang
Copy link

  • Add REQUEST_TIMEOUT environment variable to Config class
  • Pass timeout through RestApi to all Method classes
  • Configure Zodios HTTP client with configurable timeout option
  • Default to 10 minutes (600000ms) for slow-loading views
  • Update all 8 Method classes to accept and pass timeout parameter
  • Add documentation for REQUEST_TIMEOUT in optional.md
  • Fix axios import to use direct package import instead of node_modules path

This change addresses timeout issues when querying slow-loading Tableau views that can take longer than the default timeout period. Users can now configure the timeout via the REQUEST_TIMEOUT environment variable to accommodate their Tableau Server's performance characteristics.

Set REQUEST_TIMEOUT=0 to disable timeout (not recommended for production). Default value of 600000ms (10 minutes) should accommodate most use cases.

IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of
the pull request.

Pull Request Template

Description

Motivation and Context

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

How Has This Been Tested?

Related Issues

Checklist

  • I have updated the version in the package.json file by using npm run version.
    For example, use npm run version:patch for a patch version bump.
  • I have made any necessary changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Contributor Agreement

By submitting this pull request, I confirm that:

- Add REQUEST_TIMEOUT environment variable to Config class
- Pass timeout through RestApi to all Method classes
- Configure Zodios HTTP client with configurable timeout option
- Default to 10 minutes (600000ms) for slow-loading views
- Update all 8 Method classes to accept and pass timeout parameter
- Add documentation for REQUEST_TIMEOUT in optional.md
- Fix axios import to use direct package import instead of node_modules path

This change addresses timeout issues when querying slow-loading Tableau views
that can take longer than the default timeout period. Users can now configure
the timeout via the REQUEST_TIMEOUT environment variable to accommodate their
Tableau Server's performance characteristics.

Set REQUEST_TIMEOUT=0 to disable timeout (not recommended for production).
Default value of 600000ms (10 minutes) should accommodate most use cases.
Copilot AI review requested due to automatic review settings October 30, 2025 03:20
@salesforce-cla
Copy link

Thanks for the contribution! Before we can merge this, we need @westhechiang to sign the Salesforce Inc. Contributor License Agreement.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds configurable request timeout support for HTTP requests to Tableau Server. The timeout value can be set via the REQUEST_TIMEOUT environment variable and defaults to 10 minutes (600,000ms).

  • Added REQUEST_TIMEOUT configuration with parsing logic and validation
  • Propagated timeout parameter through the RestApi class to all method classes
  • Updated import of isAxiosError from direct module path to proper package import
  • Added documentation for the new configuration option

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/isAxiosError.ts Fixed import to use proper package import instead of node_modules path
src/sdks/tableau/restApi.ts Added requestTimeout property and passed it to all method class instantiations
src/sdks/tableau/methods/workbooksMethods.ts Added timeout parameter to constructor and Zodios initialization
src/sdks/tableau/methods/vizqlDataServiceMethods.ts Added timeout parameter to constructor and Zodios initialization
src/sdks/tableau/methods/viewsMethods.ts Added timeout parameter to constructor and Zodios initialization
src/sdks/tableau/methods/pulseMethods.ts Added timeout parameter to constructor and Zodios initialization
src/sdks/tableau/methods/metadataMethods.ts Added timeout parameter to constructor and Zodios initialization
src/sdks/tableau/methods/datasourcesMethods.ts Added timeout parameter to constructor and Zodios initialization
src/sdks/tableau/methods/contentExplorationMethods.ts Added timeout parameter to constructor and Zodios initialization
src/sdks/tableau/methods/authenticationMethods.ts Added timeout parameter to constructors of both authentication method classes
src/restApiInstance.ts Passed config.requestTimeout to RestApi constructor
src/config.ts Added requestTimeout property with parsing, validation, and default value logic
docs/docs/configuration/mcp-config/optional.md Added documentation for REQUEST_TIMEOUT configuration option

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +129 to +132
// Set request timeout with default of 10 minutes (600000ms) for slow-loading views
// Set to 0 to disable timeout (not recommended for production)
const requestTimeoutNumber = requestTimeout ? parseInt(requestTimeout) : 600000;
this.requestTimeout = isNaN(requestTimeoutNumber) || requestTimeoutNumber < 0 ? 600000 : requestTimeoutNumber;
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation logic allows requestTimeout to be set to 0 (when requestTimeoutNumber is exactly 0), but the comment on line 130 states 'Set to 0 to disable timeout (not recommended for production)'. The condition requestTimeoutNumber < 0 only rejects negative values, so 0 would be accepted. However, it's unclear if Zodios interprets a timeout of 0 as 'no timeout' or if this would cause issues. Consider explicitly handling the 0 case or clarifying the behavior in the comment.

Suggested change
// Set request timeout with default of 10 minutes (600000ms) for slow-loading views
// Set to 0 to disable timeout (not recommended for production)
const requestTimeoutNumber = requestTimeout ? parseInt(requestTimeout) : 600000;
this.requestTimeout = isNaN(requestTimeoutNumber) || requestTimeoutNumber < 0 ? 600000 : requestTimeoutNumber;
// Set request timeout with default of 10 minutes (600000ms) for slow-loading views.
// Set to 0 to disable timeout (i.e., wait indefinitely; not recommended for production).
const requestTimeoutNumber = requestTimeout ? parseInt(requestTimeout) : 600000;
// Accept 0 to disable timeout, but reject negative or NaN values.
this.requestTimeout =
isNaN(requestTimeoutNumber) || requestTimeoutNumber < 0
? 600000
: requestTimeoutNumber;

Copilot uses AI. Check for mistakes.
- Add 'prepare' script that runs build automatically
- Enables installation from GitHub via npx without manual build
- Fixes issue where build/ directory is gitignored but needed for execution

// Set request timeout with default of 10 minutes (600000ms) for slow-loading views
// Set to 0 to disable timeout (not recommended for production)
const requestTimeoutNumber = requestTimeout ? parseInt(requestTimeout) : 600000;
Copy link
Collaborator

@anyoung-tableau anyoung-tableau Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the Axios readme and the Zodios docs, the default timeout is "no timeout" so I think I don't understand the purpose of defaulting to a shorter timeout. Can you please explain more what you were seeing?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this file please.

"scripts": {
":build": "npx rimraf ./build && esbuild src/index.ts --bundle --packages=external --platform=node --format=esm --minify --outdir=build --sourcemap",
"build": "run-s :build exec-perms",
"prepare": "npm run build",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove


// Our dependency on Axios is indirect through Zodios.
// Zodios doesn't re-export isAxiosError, so we need to import it haphazardly through node_modules.
// Zodios doesn't re-export isAxiosError, so we need to import it directly from axios.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the changes to this file. The comment explains why it imports from node_modules directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants