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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: Linear connection 400 error + button showing check after failure
Louis Beaumont5085351c8951
diff --git a/apps/screenpipe-app-tauri/components/settings/connections-section.tsx b/apps/screenpipe-app-tauri/components/settings/connections-section.tsxindex afc098762..c719c2ae8 100644--- a/apps/screenpipe-app-tauri/components/settings/connections-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/connections-section.tsx@@ -1008,9 +1008,10 @@ function ApiIntegrationPanel({ integration, onRefresh }: {))}{error && <p className="text-xs text-destructive">{error}</p>}<div className="flex gap-2">- <Button onClick={handleTest} disabled={status === "testing" || status === "saving"} size="sm" className="gap-1.5 h-7 text-xs normal-case font-sans tracking-normal">+ <Button onClick={handleTest} disabled={status === "testing" || status === "saving"} variant={status === "error" ? "outline" : "default"} size="sm" className="gap-1.5 h-7 text-xs normal-case font-sans tracking-normal">{status === "testing" ? (<><Loader2 className="h-3 w-3 animate-spin" />testing...</>): status === "saving" ? (<><Loader2 className="h-3 w-3 animate-spin" />saving...</>)+ : status === "error" ? (<>retry</>): (<><Check className="h-3 w-3" />test & save</>)}</Button>{integration.connected && (diff --git a/crates/screenpipe-connect/src/connections/linear.rs b/crates/screenpipe-connect/src/connections/linear.rsindex 3889f8c8b..43b08db1b 100644--- a/crates/screenpipe-connect/src/connections/linear.rs+++ b/crates/screenpipe-connect/src/connections/linear.rs@@ -31,17 +31,27 @@ impl Integration for Linear {}async fn test(&self, client: &reqwest::Client, creds: &Map<String, Value>) -> Result<String> {- let api_key = require_str(creds, "api_key")?;- let resp: Value = client+ let api_key = require_str(creds, "api_key")?.trim();+ let resp = client.post("https://api.linear.app/graphql")- .bearer_auth(api_key)+ .header("Authorization", api_key).json(&json!({"query": "{ viewer { id name email } }"})).send()- .await?- .error_for_status()?- .json().await?;- let name = resp["data"]["viewer"]["name"].as_str().unwrap_or("unknown");+ let status = resp.status();+ let body: Value = resp.json().await?;+ if !status.is_success() {+ let msg = body["error"]+ .as_str()+ .or_else(|| body["errors"][0]["message"].as_str())+ .unwrap_or("unknown error");+ anyhow::bail!("Linear API error ({}): {}", status, msg);+ }+ if let Some(errors) = body.get("errors") {+ let msg = errors[0]["message"].as_str().unwrap_or("GraphQL error");+ anyhow::bail!("Linear GraphQL error: {}", msg);+ }+ let name = body["data"]["viewer"]["name"].as_str().unwrap_or("unknown");Ok(format!("connected as {}", name))}}