daveviolenza
daveviolenza
DTDrizzle Team
Created by daveviolenza on 1/8/2025 in #help
Error code 5: database is locked ExpoSQLite
Hi, hope you are well. Hopefully someone can help me as I am going loopy with this one. I recently upgraded to Expo52 and decided to give drizzle a try, all is well with select, but any insert returns:
[Error: FunctionCallException: Calling the 'getAllSync' function has failed (at ExpoModulesCore/SyncFunctionDefinition.swift:137)
→ Caused by: SQLiteErrorException: Error code 5: database is locked (at ExpoSQLite/SQLiteModule.swift:349)]
[Error: FunctionCallException: Calling the 'getAllSync' function has failed (at ExpoModulesCore/SyncFunctionDefinition.swift:137)
→ Caused by: SQLiteErrorException: Error code 5: database is locked (at ExpoSQLite/SQLiteModule.swift:349)]
The app has no kind of concurrency, it's a local db for a single user using the app, it makes absolutely no sense to get such an error, this is the code:
export const createOne = async (db, letter: string, deliverAt: dayjs.Dayjs) => {
const result = db.insert(lettersSchema).values({
letter,
has_been_read: false,
created_at: dayjs().format(sqlLiteDateFormat),
}).returning();
return result;
};
export const createOne = async (db, letter: string, deliverAt: dayjs.Dayjs) => {
const result = db.insert(lettersSchema).values({
letter,
has_been_read: false,
created_at: dayjs().format(sqlLiteDateFormat),
}).returning();
return result;
};
But it's the same across all tables, can't write due to the lock. I am using the SQLiteProvider to make sure I am not accidentaly opening multiple instances of the db, but no luck. Can anyone at least point me to the right direction? This happens exclusively with Drizzle, raw ExpoSQL works with no dramas! Thanks for any help.
1 replies