ERROR [unhandledRejection] connect ECONNREFUSED 127.0.0.1:60589

I use a drizzle-http-sqlite proxy to connect to my remote D1. After a while it hungs with this error. My issue is that I'm not connecting to a localhost so I have no idea why it happens. This is my proxy:
import { drizzle as drizzleProxy } from 'drizzle-orm/sqlite-proxy';

return drizzleProxy(async (sql, params, method) => {
const url = `https://api.cloudflare.com/client/v4/accounts/${process.env.ACCOUNT_ID}/d1/database/${process.env.D1_ID}/query`
const data = await $fetch(url, {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.TOKEN}`, 'Content-Type': 'application/json' },
body: { sql, params, method }
})
if (data?.errors?.length > 0 || !data?.success) {
throw new Error(`Error from sqlite proxy server: \n${JSON.stringify(data)}}`)
}
const qResult = data.result[0]
if (!qResult?.success) {
throw new Error(`Error from sqlite proxy server: \n${JSON.stringify(data)}`)
}
return { rows: qResult.results.map(r => Object.values(r)) }
})
import { drizzle as drizzleProxy } from 'drizzle-orm/sqlite-proxy';

return drizzleProxy(async (sql, params, method) => {
const url = `https://api.cloudflare.com/client/v4/accounts/${process.env.ACCOUNT_ID}/d1/database/${process.env.D1_ID}/query`
const data = await $fetch(url, {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.TOKEN}`, 'Content-Type': 'application/json' },
body: { sql, params, method }
})
if (data?.errors?.length > 0 || !data?.success) {
throw new Error(`Error from sqlite proxy server: \n${JSON.stringify(data)}}`)
}
const qResult = data.result[0]
if (!qResult?.success) {
throw new Error(`Error from sqlite proxy server: \n${JSON.stringify(data)}`)
}
return { rows: qResult.results.map(r => Object.values(r)) }
})
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server