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
{{ message }}
Repository navigation
DELETE /api/payload-preferences/:key returns 500 when the key does not exist (4.0.0-beta.4, Postgres) #19044
Tested on 4.0.0-beta.4, Postgres adapter, signed in as an admin:
GET /api/payload-preferences/<missing-key> → 200 {"message":"Not Found","value":null}
DELETE /api/payload-preferences/<missing-key> → 500 {"errors":[{"message":"Something went wrong."}]}
DELETE of an existing key → 200, row deleted
The log shows a DrizzleQueryError from @payloadcms/drizzledeleteOne: missing FROM-clause entry for table "<uuid>".
Likely cause: in packages/drizzle/src/deleteOne.ts (same on main), when selectDistinct with the joins finds no row, the else branch runs findFirst with the same where, which refers to the join of the user relationship, but without the joins.
Expected: 404 (or a 200 no-op), not 500.
Not checked: other database adapters.
Link to the code that reproduces this issue
Not public. The steps below need only the Postgres adapter and a signed-in user.
Reproduction Steps
Sign in to the admin (or POST /api/users/login).
GET /api/payload-preferences/does-not-exist → 200, value: null.
Activity
fix(drizzle): handle empty joined delete lookups
chore: test missing preference deletion via REST