System Information
- Strapi Version: 4.25.1
- Operating System: Windows 11
- Database: “better-sqlite3”: “8.6.0”,
- Node Version: v18.17.0
- NPM Version: 10.4.0
- Yarn Version: 1.22.21
I can’t seem to add or Save API tokens with Custom Token Type via the Strapi admin dashboard anymore. If I create a new token with Custom token type, add some permissions and hit Save, the UI hangs on the spinner and I get this error in the console:
[2024-06-26 10:23:42.270] error: delete from strapi_api_token_permissions where (id = 65) - \execution\internal\ensure-connection-callback.js:13:17)
at Runner.ensureConnection (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:318:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Runner.run (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:30:19)
at async Object.execute (C:\Repos\nextjs-corporate-starter\backend\node_modules@strapi\database\dist\index.js:4328:22)
at async Object.create (C:\Repos\nextjs-corporate-starter\backend\node_modules@strapi\database\dist\index.js:5110:9)
Subsequent attempts will change the error slightly (notice the changing id for the query:
Second attempt:
[2024-06-26 10:44:52.688] error: delete from strapi_api_token_permissions where (id = 83) - database is locked
SqliteError: delete from strapi_api_token_permissions where (id = 83) - database is locked
at Client_BetterSQLite3._query (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\dialects\better-sqlite3\index.js:44:38)
at executeQuery (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\internal\query-executioner.js:37:17)
at Client_BetterSQLite3.query (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\client.js:154:12)
at Runner.query (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:141:36)
at ensureConnectionCallback (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\internal\ensure-connection-callback.js:13:17)
at Runner.ensureConnection (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:318:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Runner.run (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:30:19)
at async Object.execute (C:\Repos\nextjs-corporate-starter\backend\node_modules@strapi\database\dist\index.js:4328:22)
at async Object.create (C:\Repos\nextjs-corporate-starter\backend\node_modules@strapi\database\dist\index.js:5110:9)
Third attempt:
[2024-06-26 11:16:32.254] error: select t0.* from strapi_api_token_permissions as t0 where (t0.id = 113) limit 1 - database is locked
SqliteError: select t0.* from strapi_api_token_permissions as t0 where (t0.id = 113) limit 1 - database is locked
at Client_BetterSQLite3._query (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\dialects\better-sqlite3\index.js:39:40)
at executeQuery (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\internal\query-executioner.js:37:17)
at Client_BetterSQLite3.query (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\client.js:154:12)
at Runner.query (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:141:36)
at ensureConnectionCallback (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\internal\ensure-connection-callback.js:13:17)
at Runner.ensureConnection (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:318:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Runner.run (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:30:19)
at async Object.execute (C:\Repos\nextjs-corporate-starter\backend\node_modules@strapi\database\dist\index.js:4328:22)
at async Object.findOne (C:\Repos\nextjs-corporate-starter\backend\node_modules@strapi\database\dist\index.js:5076:22)
[2024-06-26 11:40:15.914] error: delete from strapi_api_token_permissions where (id = 120) - database is locked
SqliteError: delete from strapi_api_token_permissions where (id = 120) - database is locked
at Client_BetterSQLite3._query (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\dialects\better-sqlite3\index.js:44:38)
at executeQuery (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\internal\query-executioner.js:37:17)
at Client_BetterSQLite3.query (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\client.js:154:12)
at Runner.query (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:141:36)
at ensureConnectionCallback (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\internal\ensure-connection-callback.js:13:17)
at Runner.ensureConnection (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:318:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Runner.run (C:\Repos\nextjs-corporate-starter\backend\node_modules\knex\lib\execution\runner.js:30:19)
at async Object.execute (C:\Repos\nextjs-corporate-starter\backend\node_modules@strapi\database\dist\index.js:4328:22)
at async Object.create (C:\Repos\nextjs-corporate-starter\backend\node_modules@strapi\database\dist\index.js:5110:9)
This only happens with the Custom token type. Using a Read-only token type works fine. I’ve also noticed creating a Custom token with no permissions works fine, but trying to add one and saving later results in hanging of the database again.
These IDs in the database always seem to point to a particular content-type:
83 api::article.article.findOne
113 api::article.article.find
120 api::article.article.findOne
This Article content-type was part of the Strapi + Next + Tailwind starter: New Strapi Starter with Next.js 13, Tailwind, and TypeScript
I have to restart the server to get the admin dashboard working again as the database seems to be locked. Going back to the API tokens seems to show the Token that didn’t finish adding, but with no permissions.
I was able to add a Custom token in the past, and I’m unsure of what has put my data and app in this weird state.
Does anybody know what’s happening here? I’m happy to provide any other additional debugging info if needed. This is quite a large blocker in my project currently.
Thanks in advance.