Also it's fine to recreate clients with Hyperdrive, it holds open connections for you.
Also it's fine to recreate clients with Hyperdrive, it holds open connections for you.
req.client will still be unused (unlikely it will be but possible?)req.cf?req.cf.client some day for some service or another.req between middleware. Otherwise you'd have no option but to laboriously pass around manually a ton of data as function arguments.ctx or similar.

req.clientreq.cfreq.cf.client const client = new Client({
connectionString: env.HYPERDRIVE.connectionString,
});
try {
// Connect to our database
await client.connect();function n(i) {
e50.apply(null, i), r = null;
}
function un() {
Et($r.connection("CONNECT_TIMEOUT", e50, D)), D.destroy();
}
function Et(H) {
ae && (ae.destroy(H), ae = null), ye && ft(ye, H), z && (ft(z, H), z = null);
}
function ft(H, ue) {
Object.defineProperties(ue, { stack: { value: ue.stack + H.origin.replace(/.*\n/, `
`), enumerable: e50.debug }, query: { value: H.string, enumerable: e50.debug }, parameters: { value: H.parameters, enumerable: e50.debug }, args: { value: H.args, enumerable: e50.debug }, types: { value: H.statement && H.statement.types, enumerable: e50.debug } }), H.reject(ue);
}function connectTimedOut() {
errored(Errors.connection('CONNECT_TIMEOUT', options, socket))
socket.destroy()
}
function errored(err) {
stream && (stream.destroy(err), stream = null)
query && queryError(query, err)
initial && (queryError(initial, err), initial = null)
}
function queryError(query, err) {
Object.defineProperties(err, {
stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
query: { value: query.string, enumerable: options.debug },
parameters: { value: query.parameters, enumerable: options.debug },
args: { value: query.args, enumerable: options.debug },
types: { value: query.statement && query.statement.types, enumerable: options.debug }
})
query.reject(err)
}