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.

Unable to register first user

default discord avatar
user22492 years ago
6

Using default payload user system


Unable to register the first user when deployed to cloud - receive the following error on call

/api/users/first-register

[17:33:50] ERROR (payload): TypeError: Cannot read properties of undefined (reading 'config')
  at /home/node/node_modules/payload/src/fields/validations.ts:322:55
  at Array.filter (<anonymous>)
  at relationship (/home/node/node_modules/payload/src/fields/validations.ts:304:41)
  at Object.field.validate (/home/node/node_modules/payload/src/fields/config/sanitize.ts:56:46)
  at promise (/home/node/node_modules/payload/src/fields/hooks/beforeChange/promise.ts:125:44)
  at processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async Promise.all (index 0)
  at traverseFields (/home/node/node_modules/payload/src/fields/hooks/beforeChange/traverseFields.ts:60:3)
  at beforeChange (/home/node/node_modules/payload/src/fields/hooks/beforeChange/index.ts:34:3)
  at create (/home/node/node_modules/payload/src/collections/operations/create.ts:174:29)
  • default discord avatar
    thedunco2 years ago

    Are you able to access the admin panel? I've always just registered the first user through there

  • default discord avatar
    user22492 years ago

    I get redirected to the first user screen

    /admin/create-first-user

    where it fails to register the user - also happens on my local


    On my local - I registered the first user on 1.6.16 which worked - will try to downgrade

  • default discord avatar
    thedunco2 years ago

    The latest version is 1.16.22, you could try using that? Why would you downgrade? Also maybe a stupid question but do you have your Payload config defined? And do you have the config path environment variable set up?

  • default discord avatar
    notchr2 years ago

    hmm what has a config property



    just weird it happens on a collection config

  • default discord avatar
    thedunco2 years ago

    Mmm, yeah, we might need to see your config

  • default discord avatar
    user22492 years ago

    Ok, I have found the issue. The plugin for last modified by from

    https://payloadcms.com/docs/plugins/overview

    was also adding it to the users - probably causing the validation to fail. So I created the first user way ahead and didn't go though that flow after while adding features/plugins. Thanks for helping !



    So downgrading and upgrading didn't work but disabling my plugins made the error location obvious.

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.