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

default discord avatar
jayzai
7 months ago
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?

  • discord user avatar
    denolfe
    Payload Team
    7 months ago

    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?

  • discord user avatar
    dribbens
    Payload Team
    7 months ago

    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.

  • discord user avatar
    denolfe
    Payload Team
    7 months ago

    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)

  • default discord avatar
    HSWMK
    7 months 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

  • discord user avatar
    denolfe
    Payload Team
    7 months 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
    }
  • default discord avatar
    HSWMK
    7 months 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
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.