Skip to content

Commit 0785251

Browse files
committed
fix(mcp): tolerate non-thenable returns in callback timedStep helper
Promise.resolve(fn()) so a synchronously-returning (e.g. mocked) step can't throw on .catch — restores the callback route unit tests.
1 parent 6aa4c9c commit 0785251

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • apps/sim/app/api/mcp/oauth/callback

apps/sim/app/api/mcp/oauth/callback/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class OauthCallbackStepTimeout extends Error {
4242
async function timedStep<T>(step: string, ms: number, fn: () => Promise<T>): Promise<T> {
4343
const start = Date.now()
4444
logger.info(`OAuth callback step start: ${step}`)
45-
const work = fn()
45+
const work = Promise.resolve(fn())
4646
work.catch(() => {})
4747
let timer: ReturnType<typeof setTimeout> | undefined
4848
try {

0 commit comments

Comments
 (0)