Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Issues with payload in Next.js using the 'next-payload' plugin

default discord avatar
teamkube2 years ago
5

I just can't get it to work properly. Every HMR (hot reload) on a component that imports the payload client (the

getPayloadClient

you get

from next-payload install

) crashes the app with the following error:



Unhandled Runtime Error


Error: Cannot overwrite _preferences model once compiled.


This seems to have something to do with mongoose used internally by payload

  • default discord avatar
    notchr2 years ago

    Hey

    @1115279317245624393

    welcome in - this issue has been mentioned previously here:

    https://discord.com/channels/967097582721572934/1112747743472005215/1112748016592486420

    Though, I don't seen a resolution posted...



    Seems like a version error? And yes, related to the preference collection



    The version chart posted by

    @217614642006982656

    lists where this issue occurs,


    13.4.0 ✅ works


    13.4.1 ✅ works


    13.4.2 ✅ works


    13.4.3 ✅ works


    13.4.4 ⚠️ Cannot overwrite _preferences model once compiled.



    Does someone from the Payload team have any additional information regarding this issue?

  • default discord avatar
    teamkube2 years ago

    I tried the version used by the demo application

    https://github.com/payloadcms/next-payload-demo

    13.2.4-canary.6 that is a lot older than 13.4.3



    maybe something got cached, ill try again with 13.4.3

  • discord user avatar
    jarrod_not_jared
    2 years ago

    I will look into this today

  • default discord avatar
    teamkube2 years ago

    setting Next to 13.4.3 + deleting ./next , ./node_modules and my package.lock solved it



    thanks a lot

  • default discord avatar
    awndrwlast year
    @281120856527077378

    did this ever get resolved (other than reverting to 13.4.3)? I just switched to mongo from postgres because of the number of issues but I'm hitting this now (next 13.5.6)

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.