Unable to register first user

default discord avatar
user2249
2 months ago
8

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
    TheDunco
    2 months ago

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

  • default discord avatar
    user2249
    2 months 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
    TheDunco
    2 months 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
    thisisnotchris
    2 months ago

    hmm what has a config property



    just weird it happens on a collection config

  • default discord avatar
    TheDunco
    2 months ago

    Mmm, yeah, we might need to see your config

  • default discord avatar
    user2249
    2 months 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.

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

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

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