Skip to content

[WIP] Fix SQLite error for missing sys_user table#429

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/fix-sqlite-no-such-table-error
Closed

[WIP] Fix SQLite error for missing sys_user table#429
Copilot wants to merge 1 commit intomainfrom
copilot/fix-sqlite-no-such-table-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 21, 2026

  • Understand root cause: sys_user table not found because Better Auth's ObjectQL adapter expects sys_user/sys_session/sys_account/sys_verification tables to exist, but no object definitions are registered for them
  • Create system auth object definitions (sys_user, sys_session, sys_account, sys_verification) as .object.yml files using Better Auth 1.5.5 camelCase field names
  • Add a systemObjectsPlugin (via createAppPlugin) pointing to the new definitions directory, loaded before AuthPlugin in objectstack.config.ts
  • Update CHANGELOG.md to reflect the fix
  • Run tests to verify nothing is broken
Original prompt

pnpm dev

2026-03-21T04:56:49.571Z ERROR [Better Auth]: SQLITE_ERROR: no such table: sys_user

SERVER_ERROR: LibsqlError: SQLITE_ERROR: no such table: sys_user

at mapSqliteError (/Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@libsql+client@0.17.2_encoding@0.1.13/node_modules/@libsql/client/lib-cjs/sqlite3.js:458:16)
at executeStmt (/Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@libsql+client@0.17.2_encoding@0.1.13/node_modules/@libsql/client/lib-cjs/sqlite3.js:361:15)
at Sqlite3Client.execute (/Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@libsql+client@0.17.2_encoding@0.1.13/node_modules/@libsql/client/lib-cjs/sqlite3.js:104:16)
... 5 lines matching cause stack trace ...
at async next (file:///Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@objectstack+objectql@3.2.8/node_modules/@objectstack/objectql/dist/index.mjs:1451:9) {

code: 'SQLITE_ERROR',
extendedCode: 'SQLITE_ERROR',
rawCode: 1,
[cause]: SqliteError: no such table: sys_user
at convertError (/Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/libsql@0.5.28/node_modules/libsql/index.js:59:12)
at Database.prepare (/Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/libsql@0.5.28/node_modules/libsql/index.js:131:13)
at executeStmt (/Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@libsql+client@0.17.2_encoding@0.1.13/node_modules/@libsql/client/lib-cjs/sqlite3.js:332:28)
at Sqlite3Client.execute (/Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@libsql+client@0.17.2_encoding@0.1.13/node_modules/@libsql/client/lib-cjs/sqlite3.js:104:16)
at TursoDriver.findOne (/Users/troysu/Documents/GitHub/objectql/packages/drivers/turso/dist/turso-driver.js:165:42)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async file:///Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@objectstack+objectql@3.2.8/node_modules/@objectstack/objectql/dist/index.mjs:1950:20
at async next (file:///Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@objectstack+objectql@3.2.8/node_modules/@objectstack/objectql/dist/index.mjs:1453:22)
at async Object.fn (file:///Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@objectstack+plugin-auth@3.2.8_mongodb@7.1.0_socks@2.8.7__next@16.1.7_react-dom@19.2.4__9a0bd08a2244b71292bea7af7a083669/node_modules/@objectstack/plugin-auth/dist/index.mjs:1317:11)
at async next (file:///Users/troysu/Documents/GitHub/objectql/node_modules/.pnpm/@objectstack+objectql@3.2.8/node_modules/@objectstack/objectql/dist/index.mjs:1451:9) {
code: 'SQLITE_ERROR',
rawCode: 1
}
}
[AuthManager] better-auth returned error: 500

The user has attached the following file paths as relevant context:

  • .github/copilot-instructions.md

创建自 VS Code


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectql Ready Ready Preview, Comment Mar 21, 2026 5:00am
objectql-demo Error Error Mar 21, 2026 5:00am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants