payload__WEBPACK_IMPORTED_MODULE_2__.default.find is not a function

default discord avatar
2 months ago

Hello Payload community!


I am trying to use the payload local api inside of a react function component.

My component is inserted BeforeDashboard.

It seems the payload.init({...}) is not fully done whern the component gets called, and so payload is not properly initialized, resulting in this error :

Uncaught (in promise) TypeError: payload


.default.find is not a function

Is there maybe another way to do what I'm trying to do?


  • discord user avatar
    Payload Team
    2 months ago

    You cannot use the local API inside of a react component. The local API is server side only, so unless you are using something like server components, then you will need to use REST or GraphQL to interact with your data 👍

  • default discord avatar
    2 months ago

    That does indeed explain everything!

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.