wrangler -j 

beta, yes.

wrangler d1 info <dbname>?
wrangler d1 migrations testdb apply --local command to apply migration, it worked successfully but when I use the prepare statement I am getting error of no table Test existswrangler -jconst batcher = await db.prepare("SELECT * FROM table WHERE ref = ?1");const batcher = await db.prepare("SELECT * FROM table WHERE ref = ?");wrangler d1 info <dbname>wrangler d1 migrations testdb apply --localObject {
message: D1_ERROR: Failed to parse body as JSON, got: error code: 1042,
cause: Failed to parse body as JSON, got: error code: 1042
}async function InsertIntoContentDatabase(db:D1Database, content:ContentDataType): Promise<D1Result<unknown>[]>{
try {
if(content.contentDataItemType === undefined){
console.log('No contentDataItemType');
throw('Missing contentDataItemType Array');
}
//Because we may have multiple items to push into the database, we need to batch the call
const batcher = await db.prepare("INSERT INTO content_models (contentGroupRef, projectRef, contentElementRef, contentBakedStatement, publishState) VALUES (?1, ?2, ?3, ?4, ?5)")
let binderCollection=[];
for (let index = 0; index < content.contentDataItemType.length; index++) {
const element = content.contentDataItemType[index];
let temp = batcher.bind(
element.contentGroupRef,
element.projectRef,
element.contentElementRef,
element.contentBakedStatement,
element.publishState
);
binderCollection.push(temp);
console.log('Loop Batch=>', JSON.stringify(temp));
}
return await db.batch(binderCollection);
} catch (error:any) {
console.log('D1 Instance=>', JSON.stringify(db.dump()));
console.log({
message: error.message,
cause: error.cause.message,
});
throw(error);
}
}Loop Batch=> {"database":{"fetcher":{}},"statement":"UPDATE content_models SET contentGroupRef = ?2, projectRef = ?3, contentBakedStatement = ?4, publishState = ?5 WHERE contentElementRef = ?1","params":["ref0","cg0","prTest0","We are proud to present a gorgeous large green wall panel square made from ivory wood.",1]}Loop Batch=> {"database":{"fetcher":{}},"statement":"INSERT INTO content_models (contentGroupRef, projectRef, contentElementRef, contentBakedStatement, publishState) VALUES (?1, ?2, ?3, ?4, ?5)","params":["cg0","prTest0","ref0","We are proud to present a gorgeous large green wall panel square made from ivory wood.",1]}Error=> Error: D1_ERROR: Failed to parse body as JSON, got: error code: 1042
at D1Database._send (cloudflare-internal:d1-api:105:19)
at async D1Database.exec (cloudflare-internal:d1-api:41:23)
at async InsertIntoContentDatabase (file:///C:XXXXX/Temp/tmp-35236-4jsc2tuBSi4U/index.js:3232:5)
at async RunContent (file:///C:XXXXX/Temp/tmp-35236-4jsc2tuBSi4U/index.js:3155:17)
at async Array.<anonymous> (file:///C:XXXXX/Temp/tmp-35236-4jsc2tuBSi4U/index.js:3727:12)
at async file:///C:XXXXX/Temp/tmp-35236-4jsc2tuBSi4U/index.js:2408:21 {
stack: Error: D1_ERROR: Failed to parse body as JSON, got…ocal/Temp/tmp-35236-4jsc2tuBSi4U/index.js:2408:21,
message: D1_ERROR: Failed to parse body as JSON, got: error code: 1042,
cause: Error: Failed to parse body as JSON, got: error code: 1042
at D1Database._send (cloudflare-inte…
}[[d1_databases]]
binding = "db1"
database_name = "test-db"
database_id = "c020574a-5623-407b-be0c-cd192bab9545"
[[d1_databases]]
binding = "db2"
database_name = "test-db"
database_id = "c020574a-5623-407b-be0c-cd192bab9545"d1_databases = [
{ binding = "db1", database_name = "db1", database_id = "1" },
{ binding = "db2", database_name = "db2", database_id = "2" }
]