.idFromName and .idFromString? Does .idFromString act as a durable object ID parser? Function names are confusing, wouldn't it make more sense parseId?.idFromName to get a DO id. The first time you do that in a given co-lo, it has to do a global lookup to confirm that it hasn't already been created somewhere else so there is a slight cost up front and maybe as you expand to more regions. After that, it's cached and has similar performance to .idFromString. idFromString has the location baked into the id itself so it doesn't have to wait to hear back from other regions when you first use it. My advice is to not worry about the miniscule and one-time performance hit from using idFromName. From what I hear that's actually more common than idFromString.audio: [...new Uint8Array(audioData)], is copying the array right? So this gets you very close to the limit, and if you have more than 1 request, then you will exceed it easily.audio: new Uint8Array(audioData) that help.@Browsable() class decorator above your Durable Object class definition. Then in your Worker intercept some custom path (like I did for /studio in the link above) and this will allow you to have access to your DO SQLite with a visual interface wherever your DO lives.ctx.storage.sql.databaseSizePRAGMA optimize is when using DO as dynamic DB :thinkies: pragma optimize at the end of the migration. thanks!
.idFromName.idFromName.idFromString.idFromString.idFromStringparseIdidFromStringidFromStringidFromName } catch (groqError) {
console.log(`Groq API failed: ${groqError.message}. Attempting Workers AI failover.`);
try {
// Workers AI Whisper Failover
console.log(`Using Workers AI failover for ${audioFile}`);
const aiResponse = await this.env.AI.run('@cf/openai/whisper-large-v3-turbo', {
audio: [...new Uint8Array(audioData)],
language: 'en'
});
transcriptionResponse = { text: aiResponse.text };
usedFailover = true;
failoverType = 'workers-ai';
} catch (workersAiError) {
// If Workers AI also fails, let the existing EC2 fallback handle it
console.log(`Workers AI failover failed: ${workersAiError.message}. Falling back to EC2.`);
throw groqError; // Rethrow original error to trigger EC2 fallback
}
}Error processing queue message: Error: Durable Object's isolate exceeded its memory limit and was reset.
2025-04-02 14:29:51:489
UTC
Error processing f576d688-9957-4cfd-816e-a0c75c34b02c_1743604179380.webm: Durable Object's isolate exceeded its memory limit and was resetaudio: [...new Uint8Array(audioData)],audio: new Uint8Array(audioData)@Browsable()/studioDurable Object exceeded its CPU time limit and was resetctx.storage.sql.databaseSizePRAGMA optimizepragma optimizeexport class Emitters extends DurableObject {
constructor(ctx, env) {
super(ctx, env);
this.default = new EventEmitter();
}
async send(command){
this.default.emit("command", command)
}
async wait(){
return await new Promise(resolve => {
this.default.once("command", e => resolve(e), {once: true})
})
}
}export class AuthDO extends DurableObject {
storage: DurableObjectStorage;
db: DrizzleSqliteDODatabase;
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
this.storage = ctx.storage;
this.db = drizzle(this.storage, { logger: false });
// Make sure all migrations complete before accepting queries.
// Otherwise you will need to run `this.migrate()` in any function
// that accesses the Drizzle database `this.db`.
ctx.blockConcurrencyWhile(async () => {
await this._migrate();
});
}
async _migrate() {
migrate(this.db, migrations);
}
async auth(req: Request) {
return auth(this.db).handler(req);
}
}