Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(connect): forward query params through connection proxy + broaden Google Sheets OAuth scope (#3030)

Louis Beaumonte3a2be5cbe1e
diff --git a/crates/screenpipe-connect/src/connections/google_sheets.rs b/crates/screenpipe-connect/src/connections/google_sheets.rs
index 733f0876d..529c1501f 100644
--- a/crates/screenpipe-connect/src/connections/google_sheets.rs
+++ b/crates/screenpipe-connect/src/connections/google_sheets.rs
@@ -29,7 +29,13 @@ static OAUTH: OAuthConfig = OAuthConfig {
extra_auth_params: &[
(
"scope",
+ // drive.metadata.readonly is needed to list spreadsheets (e.g. the
+ // list-sheets pipe calling drive/v3/files?q=mimeType=spreadsheet).
+ // Without it, file listing fails with ACCESS_TOKEN_SCOPE_INSUFFICIENT
+ // and users have to re-authorize. Read/write of cells inside a
+ // *known* sheet still only needs the spreadsheets scope.
"https://www.googleapis.com/auth/spreadsheets \
+ https://www.googleapis.com/auth/drive.metadata.readonly \
https://www.googleapis.com/auth/userinfo.email",
),
("access_type", "offline"),
diff --git a/crates/screenpipe-engine/src/connections_api.rs b/crates/screenpipe-engine/src/connections_api.rs
index 703936f87..73c8d8186 100644
--- a/crates/screenpipe-engine/src/connections_api.rs
+++ b/crates/screenpipe-engine/src/connections_api.rs
@@ -1086,6 +1086,7 @@ fn resolve_auth(
async fn connection_proxy(
State(state): State<ConnectionsState>,
axum::extract::Path((id, api_path)): axum::extract::Path<(String, String)>,
+ axum::extract::RawQuery(raw_query): axum::extract::RawQuery,
method: axum::http::Method,
headers: axum::http::HeaderMap,
body: axum::body::Bytes,
@@ -1168,8 +1169,19 @@ async fn connection_proxy(
drop(mgr); // release lock before making external request
- // Build the target URL
- let target_url = format!("{}/{}", base_url, api_path.trim_start_matches('/'));
+ // Build the target URL. Query params from the caller (e.g.
+ // `?valueInputOption=USER_ENTERED` for Google Sheets appends) must be
+ // forwarded verbatim — without this, callers silently hit defaults and
+ // bad requests like 400s on `values:append`.
+ let target_url = match raw_query.as_deref() {
+ Some(q) if !q.is_empty() => format!(
+ "{}/{}?{}",
+ base_url,
+ api_path.trim_start_matches('/'),
+ q
+ ),
+ _ => format!("{}/{}", base_url, api_path.trim_start_matches('/')),
+ };
// Audit log
tracing::info!(