Skip to content

Commit b7e23bd

Browse files
authored
Merge pull request #925 from supabase/fix/this-end-is-not-a-function-error
fix: this end is not a function error
2 parents 4b12bae + 2b6259d commit b7e23bd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib/db.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,13 @@ ${' '.repeat(5 + lineNumber.toString().length + 2 + lineOffset)}^
198198
}
199199
return { data: null, error: { code: error.code, message: error.message } }
200200
} finally {
201-
// If the error isn't a "DatabaseError" assume it's a connection related we kill the connection
202-
// To attempt a clean reconnect on next try
203-
await this.end()
201+
try {
202+
// If the error isn't a "DatabaseError" assume it's a connection related we kill the connection
203+
// To attempt a clean reconnect on next try
204+
await this.end.bind(this)
205+
} catch (error) {
206+
console.error('Failed to end the connection on error: ', { this: this, end: this.end })
207+
}
204208
}
205209
}
206210
},

0 commit comments

Comments
 (0)