Skip to content

Bug: Discovery Document fetch fails with rustls-tls on macOS (HTTP 404) #256

@showneykim

Description

@showneykim

Description

All API commands fail with discoveryError when using the pre-built binary (npm or shell installer) on macOS. The root cause is a TLS compatibility issue between rustls and Google's Discovery API servers.

$ gws drive files list --params '{"pageSize": 5}'
{
  "error": {
    "code": 500,
    "message": "Failed to fetch Discovery Document for drive/v3: HTTP 404 Not Found (tried both standard and $discovery URLs)",
    "reason": "discoveryError"
  }
}

Every service is affected — Drive (404), Gmail (403), Calendar, Sheets, etc.

Root Cause

Cargo.toml configures reqwest with rustls-tls and default-features = false:

reqwest = { version = "0.12", features = ["json", "stream", "rustls-tls"], default-features = false }

The same Discovery URL works fine with curl (which uses SecureTransport/LibreSSL on macOS):

$ curl -s -o /dev/null -w "%{http_code}" "https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"
200

Fix

Switching to native-tls resolves the issue immediately:

reqwest = { version = "0.12", features = ["json", "stream", "native-tls"] }

After rebuilding from source with this change, all APIs work correctly:

$ cargo build --release  # with native-tls
$ ./target/release/gws drive files list --params '{"pageSize": 3}'
{
  "files": [ ... ],  # works!
  "kind": "drive#fileList"
}

Environment

  • OS: macOS 15 (Darwin 25.3.0), Apple Silicon (aarch64)
  • gws version: 0.6.3 (both npm and shell installer binaries)
  • Install methods tested: npm install -g @googleworkspace/cli, shell installer script
  • Node: v24.13.0

Suggested Fix

Consider one of:

  1. Switch to native-tls (uses platform TLS — SecureTransport on macOS, SChannel on Windows, OpenSSL on Linux)
  2. Use feature flags to allow both backends: rustls-tls + native-tls-vendored as fallback
  3. Investigate the specific rustls/Google API server incompatibility (possibly related to TLS session handling or certificate chain verification)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions