You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a collection is set up to have a block which include a Select field with hasMany enabled, any value added to the Select field would cause a SQLite foreign key constraint failure.
ERROR: There was an error while saving a version for the Post with ID 1.
err: {
"type": "Error",
"message": "FOREIGN KEY constraint failed",
"stack":
Error: FOREIGN KEY constraint failed
at Object.next (payload\node_modules\.pnpm\[email protected]\node_modules\libsql\index.js:335:20)
at Statement.all (payload\node_modules\.pnpm\[email protected]\node_modules\libsql\index.js:360:16)
at executeStmt (payload\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@libsql\client\lib-cjs\sqlite3.js:285:34)
at Sqlite3Client.execute (payload\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@libsql\client\lib-cjs\sqlite3.js:101:16)
at LibSQLPreparedQuery.values (payload\node_modules\.pnpm\[email protected]_@[email protected][email protected][email protected]__@neondatabase_6resdlyducyo6357g5vrmmkeri\node_modules\src\libsql\session.ts:262:57)
at LibSQLPreparedQuery.all (payload\node_modules\.pnpm\[email protected]_@[email protected][email protected][email protected]__@neondatabase_6resdlyducyo6357g5vrmmkeri\node_modules\src\libsql\session.ts:191:27)
at QueryPromise.all (payload\node_modules\.pnpm\[email protected]_@[email protected][email protected][email protected]__@neondatabase_6resdlyducyo6357g5vrmmkeri\node_modules\src\sqlite-core\query-builders\insert.ts:355:26)
at QueryPromise.execute (payload\node_modules\.pnpm\[email protected]_@[email protected][email protected][email protected]__@neondatabase_6resdlyducyo6357g5vrmmkeri\node_modules\src\sqlite-core\query-builders\insert.ts:367:40)
at QueryPromise.then (payload\node_modules\.pnpm\[email protected]_@[email protected][email protected][email protected]__@neondatabase_6resdlyducyo6357g5vrmmkeri\node_modules\src\query-promise.ts:31:15)
"rawCode": 787,
"code": "SQLITE_CONSTRAINT_FOREIGNKEY",
"libsqlError": true
}
TypeError: Cannot read properties of undefined (reading 'title')
at promise (payload\packages\payload\src\fields\hooks\afterRead\promise.ts:133:22)
at payload\packages\payload\src\fields\hooks\afterRead\traverseFields.ts:75:14
at Array.forEach (<anonymous>)
at forEach (payload\packages\payload\src\fields\hooks\afterRead\traverseFields.ts:73:10)
at afterRead (payload\packages\payload\src\fields\hooks\afterRead\index.ts:71:17)
at updateDocument (payload\packages\payload\src\collections\operations\utilities\update.ts:320:27)
at updateByIDOperation (payload\packages\payload\src\collections\operations\updateByID.ts:165:18)
at Object.<anonymous> (payload\test\_community\int.spec.ts:52:21)
Describe the Bug
When a collection is set up to have a block which include a Select field with hasMany enabled, any value added to the Select field would cause a SQLite foreign key constraint failure.
Repro setup: blueset@e917804
Error message:
Link to the code that reproduces this issue
https://github.com/blueset/payload/blob/select-in-block-bug/test/_community/int.spec.ts
Reproduction Steps
git clone https://github.com/blueset/payload git switch select-in-block-bug pnpm test:int:sqlite "_Community"
Observe the test failure.
Which area(s) are affected? (Select all that apply)
db-sqlite
Environment Info
The text was updated successfully, but these errors were encountered: