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

Error related to pagination limit when join field is set. #8707

Closed
energee opened this issue Oct 15, 2024 · 12 comments
Closed

Error related to pagination limit when join field is set. #8707

energee opened this issue Oct 15, 2024 · 12 comments
Assignees

Comments

@energee
Copy link

energee commented Oct 15, 2024

Link to reproduction

No response

Environment Info

Node: 22.9.0
npm: 10.8.3
Yarn: 1.22.22
pnpm: 9.10.0
Relevant Packages:
payload: 3.0.0-beta.113
next: 15.0.0-canary.173
@payloadcms/db-mongodb: 3.0.0-beta.113
@payloadcms/graphql: 3.0.0-beta.113
@payloadcms/next/utilities: 3.0.0-beta.113
@payloadcms/richtext-lexical: 3.0.0-beta.113
@payloadcms/translations: 3.0.0-beta.113
@payloadcms/ui/shared: 3.0.0-beta.113
react: 19.0.0-rc-3edc000d-20240926
react-dom: 19.0.0-rc-3edc000d-20240926

Describe the Bug

Error: invalid argument to $limit stage: Expected a number in: $limit: "10"

Once pagination is set on the collection view, the page fails due to this error.

The limit and other arguments do not get set on the URL.

When i manually set a limit argument on the url eg "?limit=100", it prevents this error.

I don't think this error was present in beta 111.

Reproduction Steps

This occurs when there is a join field on the collection view being displayed.

Use the "per page" pagination, which subsequently should set the limit argument on the URL.

Adapters and Plugins

db-mongodb

@energee energee added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Oct 15, 2024
@energee
Copy link
Author

energee commented Oct 16, 2024

This appears to be resolved in 114

@energee energee closed this as completed Oct 16, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 16, 2024
@energee
Copy link
Author

energee commented Oct 16, 2024

Sorry, spoke too soon still seeing the issue.

Image

@energee energee reopened this Oct 16, 2024
@github-actions github-actions bot added the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 16, 2024
@JarrodMFlesch
Copy link
Contributor

@energee I am trying to follow but struggling to. Can you provide a screenshot of the view you are experiencing this in?

@JarrodMFlesch JarrodMFlesch self-assigned this Oct 16, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 16, 2024
@energee
Copy link
Author

energee commented Oct 16, 2024

Screen.Recording.2024-10-16.at.3.22.34.PM.mov

@energee
Copy link
Author

energee commented Oct 16, 2024

It seems like i can adjust the pagination but when i navigate to: /admin/collection/[collection-slug] and payload retrieves the limit from mongoDB, it fails (looks like its getting a string?)

@BrianJM
Copy link

BrianJM commented Oct 24, 2024

I am also getting this error.

"@payloadcms/db-mongodb": "3.0.0-beta.118",

 ⨯ node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_/node_modules/mongodb/lib/cmap/connection.js (231:1) @ Connection.onMessage
 ⨯ MongoServerError: invalid argument to $limit stage: Expected a number in: $limit: "10"
    at MessageStream.emit (node:events:519:28)
    at Socket.emit (node:events:519:28)
digest: "2508765017"
  229 |                 }
  230 |                 if (document.ok === 0 || document.$err || document.errmsg || document.code) {
> 231 |                     callback(new error_1.MongoServerError(document));
      | ^
  232 |                     return;
  233 |                 }
  234 |             }

Image

@andershermansen
Copy link
Contributor

Try to update to v3.0.0-beta.121 or later where #8913 is fixed. The error message seems the same.

@energee
Copy link
Author

energee commented Nov 4, 2024

From what I can see so far, it appears to be resolved, running beta.123

@HriBB
Copy link

HriBB commented Nov 4, 2024

I'm still seeing thig even in v3.0.0-beta.124.

Error: invalid argument to $limit stage: Expected a number in: $limit: "100"
    at resolveErrorDev (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]_olzgyrhn3cj6yjvy663zgvkzo4/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js:1790:63)
    at processFullStringRow (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]_olzgyrhn3cj6yjvy663zgvkzo4/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js:2067:17)
    at processFullBinaryRow (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]_olzgyrhn3cj6yjvy663zgvkzo4/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js:2055:7)
    at progress (webpack-internal:///(app-pages-browser)/./node_modules/.pnpm/[email protected][email protected][email protected]_olzgyrhn3cj6yjvy663zgvkzo4/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js:2258:17)

It works on one collection, but does not work on the other.

@energee
Copy link
Author

energee commented Nov 4, 2024

@HriBB you might want to try clearing out your payload-preferences table, it looks like the config is being sanitized on its way INTO the database so it won't go away until that is reset.

@HriBB
Copy link

HriBB commented Nov 5, 2024

Thanks @energee! That solved the problem ;)

@energee energee closed this as completed Nov 5, 2024
Copy link
Contributor

github-actions bot commented Nov 7, 2024

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants