Like what we’re doing? Star us on GitHub!

GraphQL Error on Startup

2 months ago

My docker container gives me the following logs on startup:

[17:05:31] INFO (payload): Starting Payload...
    throw new Error(message);

Error: Expected DateTime to be a GraphQL nullable type.
    at devAssert (/home/node/app/node_modules/payload/node_modules/graphql/jsutils/devAssert.js:12:11)
    at new GraphQLNonNull (/home/node/app/node_modules/payload/node_modules/graphql/type/definition.js:395:32)
    at /home/node/app/node_modules/payload/dist/collections/graphql/init.js:101:23
    at Array.forEach (<anonymous>)
    at initCollectionsGraphQL (/home/node/app/node_modules/payload/dist/collections/graphql/init.js:60:38)
    at registerSchema (/home/node/app/node_modules/payload/dist/graphql/registerSchema.js:58:24)
    at init (/home/node/app/node_modules/payload/dist/init.js:79:38)
    at initSync (/home/node/app/node_modules/payload/dist/init.js:143:22)
    at Payload.init (/home/node/app/node_modules/payload/dist/index.js:154:29)
    at Object.<anonymous> (/home/node/app/dist/server.js:15:19)

My docker compose file looks like this (some parts redacted):

    image: node:18-alpine
      - '3001:3001'
      - ./payload:/home/node/app
    working_dir: /home/node/app/
    command: sh -c "npm run serve"
      - mongo
      MONGODB_URI: mongodb://mongo:27017/payload
      PORT: 3001
      - main

    image: mongo:latest
      - '27017:27017'
      - --storageEngine=wiredTiger
      - data:/data/db
      driver: none
      - main

and the


directory I mount to my docker container contains a payload project I have already run

npm run build


  • Exo
    2 months ago

    It seems the npm based installation workflow is broken.

    Can you try deleting your


    folder and


    . Then run

    yarn install

    and check again?

  • alexdev
    2 months ago

    this is plausible, I am using npm

    I am currently building in an ubuntu worker and then transferring the whole directory over to the host, including node_modules into the ./payload directory mentioned above

  • Exo
    2 months ago

    that makes sense, I had a similar setup. After switching to yarn you should be fine I think 🙂

  • alexdev
    2 months ago

    so rework the whole workflow to use yarn?

    i'll give it a go now

    switched to yarn, deploys perfectly!

    although this is now the only component of the project that utilises yarn over npm, not world ending but I wonder what is cauting the issue?

  • Exo
    2 months ago

    The problem seems that there are 2 different versions of the GraphQL engine being used (one directly and another as a dependency). With yarn this is no problem, as you can write rules for how to handle that (overrides.json) but npm is a bit more strict.

    Same for me, usually it is npm everywhere, once the dependencies are fixed we can switch back 🙂

    oh btw, if everything works, please close this thread unless you need more help, this helps to keep things organized 🙂

    @jmikrut another occurrence of this bug, I think I commented yesterday on a related github issue (which I can't find right now) but the npm workflow is quite broken as of now 😦

  • jmikrut
    Payload Team
    2 months ago

    ahhh is this related to



  • Exo
    2 months ago

    Yes I think so 🙂

    should be reproducable with the minimal setup, but I did not try yet

  • jmikrut
    Payload Team
    2 months ago

    ok i'll put this on the radar. I hear that


    is no longer supported so it's probably just that we need to move to a package that uses our graphql version

  • alexdev
    2 months ago

    Thanks for all the help guys, will close the thread now

    3 weeks ago

    still got the problem, using pnpm on railway, working on local

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More