Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Attempted import error: 'validOperatorSet' is not exported from 'payload/shared' (imported as 'CM'). #10906

Closed
blackmouse572 opened this issue Jan 31, 2025 · 3 comments

Comments

@blackmouse572
Copy link

blackmouse572 commented Jan 31, 2025

Describe the Bug

While trying to use search plugin to add my own collections by adding to the list

  searchPlugin({
    collections: ['posts', 'stories', 'chapters'],
    beforeSync: beforeSyncWithSearch,
    searchOverrides: {
      fields: ({ defaultFields }) => {
        return [...defaultFields, ...searchFields]
      },
    },
  }),

After navigate to /admin i got

Image

I have tried:

  • Remove the node_modules folders and install again
  • Use all latest package of payload

Link to the code that reproduces this issue

https://github.com/blackmouse572/Monga

Reproduction Steps

  1. Install packages with yarn
  2. Navigate to localhost:3000/admin

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

area: core, plugin: search

Environment Info

Binaries:
  Node: 20.18.2
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.17.1
  next: 15.1.5
  @payloadcms/db-postgres: 3.17.1
  @payloadcms/email-nodemailer: 3.17.1
  @payloadcms/graphql: 3.17.1
  @payloadcms/live-preview: 3.17.1
  @payloadcms/live-preview-react: 3.17.1
  @payloadcms/next/utilities: 3.17.1
  @payloadcms/payload-cloud: 3.17.1
  @payloadcms/plugin-form-builder: 3.17.1
  @payloadcms/plugin-nested-docs: 3.17.1
  @payloadcms/plugin-redirects: 3.17.1
  @payloadcms/plugin-search: 3.20.0
  @payloadcms/plugin-seo: 3.17.1
  @payloadcms/richtext-lexical: 3.17.1
  @payloadcms/translations: 3.17.1
  @payloadcms/ui/shared: 3.17.1
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home Single Language
  Available memory (MB): 14189
  Available CPU cores: 12
@blackmouse572 blackmouse572 added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Jan 31, 2025
@akhrarovsaid
Copy link
Contributor

akhrarovsaid commented Jan 31, 2025

Hey @blackmouse572,

It's because you are using 3.17.1 for all of your Payload packages but are using 3.20.0 for plugin-search. All of your Payload packages should match version numbers and you should not mismatch Payload versions.

validOperatorSet was also added in 3.18.0 iirc so thats why plugin-search is looking for it. Try updating the rest of your packages to 3.20.0 or downgrading plugin-search to 3.17.1 to match.

@blackmouse572
Copy link
Author

blackmouse572 commented Jan 31, 2025

Hi @akhrarovsaid ,
Thanks for your response, how can this possible? I have change “latest” version off all payload package in packages.json

Shouldn’t all the packages be sync with same versions?

@akhrarovsaid
Copy link
Contributor

Hey @blackmouse572,

Not necessarily. If you want all version to be synced across all environments with a certainty, you should pin the versions. In your package.json set all of your payload versions to a distinct version without any carets (^). Delete node_modules and your lockfile and reinstall. You can also use the list or why utilities of your package manager to determine what versions you have installed at any point.

@payloadcms payloadcms locked and limited conversation to collaborators Jan 31, 2025
@AlessioGr AlessioGr converted this issue into discussion #10912 Jan 31, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Jan 31, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants