mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-21 08:03:33 +00:00
fix: delete AppConnect's token variable when linking its account fails, so Save can be retried
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b1ee201978
commit
b8f7849a7d
+3
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT EXISTS(SELECT 1 FROM variable WHERE account = $1 AND workspace_id = $2)",
|
||||
"query": "SELECT EXISTS(SELECT 1 FROM variable WHERE account = $1 AND workspace_id = $2 AND path <> $3)",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -12,6 +12,7 @@
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4",
|
||||
"Text",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
@@ -19,5 +20,5 @@
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "7aa589db3199d7f727cc69e63e1281b7ed329ff0c9d1617747f4ccd6014720cf"
|
||||
"hash": "92d2202c8752ab24777daa5c46b14ae645076a85940cef890083a45301a7cd62"
|
||||
}
|
||||
@@ -1005,10 +1005,19 @@
|
||||
}
|
||||
})
|
||||
if (accountData) {
|
||||
await OauthService.createAccount({
|
||||
workspace: effectiveWorkspace,
|
||||
requestBody: { ...accountData, variable_path: tokenPath }
|
||||
})
|
||||
try {
|
||||
await OauthService.createAccount({
|
||||
workspace: effectiveWorkspace,
|
||||
requestBody: { ...accountData, variable_path: tokenPath }
|
||||
})
|
||||
} catch (e) {
|
||||
// An unlinked token never refreshes, and its path would block a retry.
|
||||
await VariableService.deleteVariable({
|
||||
workspace: effectiveWorkspace,
|
||||
path: tokenPath
|
||||
}).catch(() => {})
|
||||
throw e
|
||||
}
|
||||
}
|
||||
resourceValue['token'] = `$var:${tokenPath}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user