Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot create as TypeComposer the following value: Date. #23062

Closed
jack0wsky opened this issue Apr 13, 2020 · 11 comments
Closed

Error: Cannot create as TypeComposer the following value: Date. #23062

jack0wsky opened this issue Apr 13, 2020 · 11 comments
Labels
status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. topic: GraphQL Related to Gatsby's GraphQL layer

Comments

@jack0wsky
Copy link

jack0wsky commented Apr 13, 2020

Description

While running 'gatsby develop' everything works till graphql schema is going to be built. Then it throws error.

ERROR 

UNHANDLED REJECTION Cannot create as TypeComposer the following value: Date.



 Error: Cannot create as TypeComposer the following value: Date.
 
 - SchemaComposer.js:365 SchemaComposer.createTempTC
   [store]/[graphql-compose]/lib/SchemaComposer.js:365:11
 
 - SchemaComposer.js:563 SchemaComposer.addAsComposer
   [store]/[graphql-compose]/lib/SchemaComposer.js:563:27
 
 - schema-composer.js:35 createSchemaComposer
   [store]/[gatsby]/dist/schema/schema-composer.js:35:18
 
 - index.js:135 Object.build
   [store]/[gatsby]/dist/schema/index.js:135:26
 
 - index.js:419 async module.exports
   [store]/[gatsby]/dist/bootstrap/index.js:419:3
 
 - develop.js:429 async module.exports
   [store]/[gatsby]/dist/commands/develop.js:429:7
 
not finished building schema - 0.172s

Steps to reproduce

Everything worked well until I installed Apollo dependencies and plugin

Expected result

Error shouldn't appear and app should work

Actual result

Error when building graphql schema

Environment

  System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 13.12.0 - ~/.nvm/versions/node/v13.12.0/bin/node
    Yarn: 1.22.4 - ~/.nvm/versions/node/v13.12.0/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v13.12.0/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 80.0.3987.163
    Firefox: 74.0.1
    Safari: 13.1
  npmPackages:
    gatsby: ^2.20.12 => 2.20.18
    gatsby-cli: ^2.11.7 => 2.11.7
    gatsby-image: ^2.3.1 => 2.3.2
    gatsby-plugin-apollo: ^3.0.1 => 3.0.1
    gatsby-plugin-manifest: ^2.3.3 => 2.3.3
    gatsby-plugin-offline: ^3.1.2 => 3.1.2
    gatsby-plugin-react-helmet: ^3.2.1 => 3.2.2
    gatsby-plugin-sharp: ^2.5.3 => 2.5.4
    gatsby-plugin-styled-components: ^3.2.1 => 3.2.1
    gatsby-source-filesystem: ^2.2.2 => 2.2.2
    gatsby-source-graphql: ^2.3.2 => 2.3.2
    gatsby-source-shopify: ^3.1.2 => 3.1.2
    gatsby-theme-apollo: ^3.0.2 => 3.0.2
    gatsby-transformer-sharp: ^2.4.3 => 2.4.4
  npmGlobalPackages:
    gatsby-cli: 2.11.7
    gatsby-starter-default: 0.1.0

@jack0wsky jack0wsky added the type: bug An issue or pull request relating to a bug in Gatsby label Apr 13, 2020
@KyleAMathews
Copy link
Contributor

Can you try removing node_modules and reinstalling? Something is breaking the schema creation and it doesn't seem like any of those dependencies would do that.

@jack0wsky
Copy link
Author

Can you try removing node_modules and reinstalling? Something is breaking the schema creation and it doesn't seem like any of those dependencies would do that.

I tried this solution but didn't work. I will try one more time

@LekoArts LekoArts added status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. and removed type: bug An issue or pull request relating to a bug in Gatsby labels Apr 14, 2020
@LekoArts
Copy link
Contributor

Hi!

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Thanks for using Gatsby! 💜

@vladar vladar added the topic: GraphQL Related to Gatsby's GraphQL layer label Apr 14, 2020
@ParadoxMH
Copy link

I have the same issue after update graphql to 15.0.0
@jack0wsky have you found a solution?

@jack0wsky
Copy link
Author

I have the same issue after update graphql to 15.0.0
@jack0wsky have you found a solution?

No, uninstalled Apollo and refused to solve it :/

@pkleckner
Copy link

In case it helps anyone, I had this issue last night. The solution that seemed to work for me was to delete both the node_modules folder and the package-lock.json file, and then reinstall.

@wardpeet
Copy link
Contributor

You probably want to make sure only one grapqhl version is inside your project.

try running

npm ls graphql
yarn why graphql

If you have multiple, please use yarn resolutions or remove your lock file and node_modules.

We're marking this issue as answered and closing it for now but please feel free to reopen this and comment if you would like to continue this discussion. We hope we managed to help and thank you for using Gatsby! 💜

@jack0wsky
Copy link
Author

jack0wsky commented May 13, 2020

For those who will face this issue, I found out that you simply need to install older version of GraphQL. In my case, I had to install graphql@^14.6.0 instead of 15.0.0 version.

@p0wl
Copy link

p0wl commented May 14, 2020

Installing graphql@^14.6.0 wasn't enough for me.
Had to update all dependencies (probably especially gatsby) to solve the issue.

@guillempuche
Copy link

For me, it wasn't downdating Graphql from v15.0 (the latest) to v14.6.0, the solution was in updating Gatsby from v2.21 to v2.23.1 (the latest).

@pfftdammitchris
Copy link

pfftdammitchris commented Jul 19, 2020

I think the issue was having a different graphql version installed.
I had graphql installed in dependencies, uninstalled it, was having the error still, then npm install gatsby and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. topic: GraphQL Related to Gatsby's GraphQL layer
Projects
None yet
Development

No branches or pull requests

10 participants