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

v1.6.4 - failing to build in production mode - multiple version of GraphQL

jayzai
last month
8

I am trying to build payload using the generated Dockerfile by the

create-payload-app

script. It tries to build application using the build script which generates a bundle folder that is including multiple versions of GraphQL as shown with this error:


Error: Cannot use GraphQLScalarType "DateTime" from another module or realm.

But fixing it by forcing the latest version of graphql with a resolution block in package.json breaks the admin interface as they are expected older versions.


"resolutions": {
    "graphql": "16.6.0",
    "**/graphql": "16.6.0"
  },


So what versions should satisfy both, server and admin interface?

  • denolfe
    Payload Team
    last month

    Hey @jayzai , I'm taking a look into this now. Let me try to recreate.



    I'm not able to recreate this. Which template did you choose? Did you perform any modifications?

  • dribbens
    Payload Team
    last month

    There is a related thread on github,

    https://github.com/payloadcms/payload/discussions/1856

    about this problem while using npm. What package manager are you using?


    We're going to look into this more today.



    I

    was

    able to recreate the graphql error from the steps in the thread on github ^


    That should give us more to look into.

  • denolfe
    Payload Team
    last month

    Interesting, @jayzai does your Dockerfile contain npm commands or yarn commands? (This is generated by create-payload-app based upon what you have installed on your machine)

  • HSWMK
    4 weeks ago

    Hello, got almost this problem today, Error: Expected DateTime to be a GraphQL nullable type.



    Using PNPM, working in build in local, but crash in railway ,,,



    The worse thing is i don't even use GraphQL, it would be really great to dissociate GraphQL and import it as a subpackage for people wanting to use it

  • denolfe
    Payload Team
    4 weeks ago

    We definitely have had this conversation and have plans to abstract out certain pieces from the core of Payload if it makes sense.



    In the meantime, you could disable graphql by putting this in your config


    graph: {
      disable: true
    }
  • HSWMK
    4 weeks ago

    My bad didn’t saw this configuration option, thank you ! But yeah it would be great to have it only if wanted 🙏

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