i had it enabled but disabled since we were getting these issues
i had it enabled but disabled since we were getting these issues
FYI, disabling replicas is not instant. If replicas are created and process some of your queries, it can take a few hours for them to stop processing queries and completely disappear.you said you're getting issues on a prod db? It still impacting, does creating a new db work around it, etc?

"message": "internal error; reference = e_PVSMDp_85064edabe1b49f79d1f0a92065fcb4d"01479222
new_databases under the [[migrations]]? The [[migrations]] block is for the Durable Objects, not D1. See https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/Error: TypeError: dba.prepare is not a function it seems you are using dba as the D1 Binding variable, but your actual binding in your wrangler toml seems to be defined as DB, so without the code you are actually running I am not sure what you are doing wrong.WebsiteVerificationReport.create(..) is called, which is the one causing you issues. The error implies that you are passing the wrong argument for c.{
"errors": [
{
"code": 7500,
"message": "Currently processing a long-running export."
}
],
"success": false,
"messages": [],
"result": []
}export interface IWebsiteVerificationReport {
domain: string,
slug: string,
verification: string,
status: boolean,
message: string,
sanityDocId: string,
audience: string,
location?: string,
runAt?: Date
}durable_objects.bindings = [{ name = "REQUEST_QUEUE", class_name = "RequestQueue" }]
d1_databases = [
{ binding = "DB", database_name = "lightmode-store", database_id = "c1766ce5-234c-401b-a854-d614c5c1d300" },
]
[[migrations]]
tag = "v1"
new_classes = ["RequestQueue"]
new_databases = ["lightmode-store"]{
"alwaysPrimarySession": {
"fetcher": {},
"bookmarkOrConstraint": "first-primary"
},
"fetcher": {}
}WebsiteVerificationReport.create(..)cexport async function post(c: any, resultCheck?: IWebsiteVerificationReport, db?: any) {
let data;
try {
if (resultCheck?.domain) {
data = resultCheck;
} else {
data = await c.req.json();
}
} catch (error) {
return c.text('Invalid JSON input', 400);
}
if (!data.domain || !data.slug || !data.verification || typeof data.status != 'boolean') {
return new Response('Missing required fields', {status: 400});
// return c.text('Missing required fields', 400);
}
try {
const report = WebsiteVerificationReport.fromObject(data);
const result = await WebsiteVerificationReport.create(report, c, db);
return new Response(`${{ success: true, result }}`, {status: 201})
// return c.json({ success: true, result }, 201);
}
catch (error) {
console.error("Error:", error);
return new Response('Error inserting data into database', {status: 500});
// return c.text("Error inserting data into database", 500);
}
}export const saveReport = async(context: any, data: any, domain: string, db?: any) => {
try {
console.log(JSON.stringify(`App in ctx is ${JSON.stringify(context)}`))
await post(context!, data, db);
} catch (error) {
console.error(error);
return new Response(`Error while managing ckecks for website ${domain}. \n Message: ${error}.`, {status: 500} );
}
}export class RequestQueue {
private queue: Array<any> = [];
private isProcessing = false;
async fetch(request: Request): Promise<Response> {
const { method } = request;
if (method === 'POST') {
const payload = await request.json<LightModeQueueObject>();
console.log(`Received payload: ${JSON.stringify(payload)}`); // Log the payload for debugging
// Validate the payload
if (!payload || !payload.proxyUrl || !payload.data || !payload.bearerToken) {
console.error('Invalid payload:', payload);
return new Response('Invalid payload', { status: 400 });
}
this.queue.push(payload);
this.processQueue();
return new Response('Enqueued');
}
return new Response('Method not allowed', { status: 405 });
}
private async processQueue() {
if (this.isProcessing || this.queue.length === 0) return;
this.isProcessing = true;
const payload = this.queue.shift();
try {
let data;
let result: any = await checkLightMode(payload.proxyUrl, payload.data, payload.bearerToken);
await saveReport(payload.context, data, payload.data.domain.replace('https://', '').replace('http://', ''));
} catch (error) {
console.error(`Error processing payload: ${JSON.stringify(payload)} - ${error}`);
}
}
}export async function getLightModesChecks(c: Context<{ Bindings: Env }>)const payload: LightModeQueueObject = {
data: config,
proxyUrl: c.env.PROXY_API_URL,
bearerToken: bearerToken,
document: config.document!,
context: c,
db: c.env.DB
}
await queue.fetch('https://dummy-url/queue', { // The url is just a placeholder, it won't be used.
method: 'POST',
body: JSON.stringify(payload),
});