Skip to content

Commit 37e57ee

Browse files
committed
fix(mcp): narrow workspaceId before async closure in OAuth createClient
1 parent 0bd2c7c commit 37e57ee

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/sim/lib/mcp/service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class McpService {
194194
if (!userId || !config.workspaceId) {
195195
throw new Error('OAuth MCP server requires both userId and workspaceId')
196196
}
197+
const workspaceId = config.workspaceId
197198

198199
// Load the row inside the refresh lock so concurrent callers observe tokens
199200
// written by a predecessor refresh, rather than a stale snapshot. Without
@@ -204,7 +205,7 @@ class McpService {
204205
const row = await getOrCreateOauthRow({
205206
mcpServerId: config.id,
206207
userId,
207-
workspaceId: config.workspaceId,
208+
workspaceId,
208209
})
209210
if (!row.tokens) {
210211
throw new McpOauthAuthorizationRequiredError(config.id, config.name)

0 commit comments

Comments
 (0)