Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation Query Path Issue #9210

Open
GeorgeHulpoi opened this issue Nov 14, 2024 · 0 comments
Open

Validation Query Path Issue #9210

GeorgeHulpoi opened this issue Nov 14, 2024 · 0 comments

Comments

@GeorgeHulpoi
Copy link
Contributor

GeorgeHulpoi commented Nov 14, 2024

Describe the Bug

Seems like the error is because of secretKey field's access on read. Replacing the read: ({ req: { context } }) => context.operation === 'create', with read: () => true, seems to fix the issue.

Also, it's specific to the database adapter. This bug appeared after changing the database adapter from MongoDB to Postgres (on a personal project).

Link to the code that reproduces this issue

https://github.com/GeorgeHulpoi/payload-query-path-validation-bug

Reproduction Steps

  1. Go to col1 collection and create a documment.
  2. Try to fetch /api/col1/{id}
  3. You will receive the following error:
{"errors":[{"name":"QueryError","data":[{"path":"secretKey"}],"message":"The following path cannot be queried: secretKey"}]}

Which area(s) are affected? (Select all that apply)

db-postgres, area: core

Environment Info

> [email protected] payload C:\Payload\payload-db-transiction-bug
> cross-env NODE_OPTIONS=--no-deprecation payload "info"


Binaries:
  Node: 20.9.0
  npm: N/A
  Yarn: N/A
  pnpm: 9.4.0
Relevant Packages:
  payload: 3.0.0-beta.130
  next: 15.0.0
  @payloadcms/db-postgres: 3.0.0-beta.130     
  @payloadcms/email-nodemailer: 3.0.0-beta.130
  @payloadcms/graphql: 3.0.0-beta.130
  @payloadcms/next/utilities: 3.0.0-beta.130  
  @payloadcms/payload-cloud: 3.0.0-beta.130   
  @payloadcms/richtext-lexical: 3.0.0-beta.130
  @payloadcms/translations: 3.0.0-beta.130
  @payloadcms/ui/shared: 3.0.0-beta.130
  react: 19.0.0-rc-65a56d0e-20241020
  react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 14189
  Available CPU cores: 16
@GeorgeHulpoi GeorgeHulpoi added status: needs-triage Possible bug which hasn't been reproduced yet v3 validate-reproduction labels Nov 14, 2024
@r1tsuu r1tsuu self-assigned this Nov 15, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants