graphiql: TypeError: Cannot read property 'schemaPath' of undefined

Hi,

I cannot make this run on Windows 😭 I am receiving this error:

(node:6500) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Error - 14:13:40] Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: Cannot read property 'projectName' of undefined
  Code: -32603 

This is my .graphqlconfig.yml

projects:
  app:
    schemaPath: "src/data/yoga/schema.graphql"
    includes: ["src/**/*.graphql"]
    extensions:
      endpoints:
        default: "http://localhost:4000"
      codegen:
        - generator: prisma-binding
          language: typescript
          output: 
            binding: src/data/generated/api.ts
  prisma:
    schemaPath: "src/data/generated/prisma.graphql"
    includes: ["src/**/*.graphql"]
    extensions:
      prisma: src/data/prisma/prisma.yml
      codegen:
        - generator: prisma-binding
          language: typescript
          output: 
            binding: src/data/generated/prisma.ts

All Works well on MAC with this setup

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 22
  • Comments: 36 (5 by maintainers)

Most upvoted comments

Wow, the issue is still persists

Facing this issue as well using vscode on MacOS.

It appears that the project key must be equal to the folder name in vscode. For example:

{
  "projects": {
    "folder-name": { <---- this needs to be the folder you are working on
      "schemaPath": "generated/schema.graphql",
      "includes": ["src/graphql/**/*.graphql"],
      "extensions": {
        "endpoints": {
          "prod": "http://localhost:4000"
        }
      }
    }
  }
}

Is there at least any workaround?

Just installed plugin. Same error

[Error - 6:19:54 PM] Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: Cannot read property 'projectName' of undefined
  Code: -32603

MacOS

Any news? Aparently v3.0.0-alpha.13 of graphql-config is out which resolves this issue. Apollo vsconfig extension eats up all my CPU unfortunately, so I was hoping on using prisma vsconfig, which does not work at all currently.

Same problem on osx:

{
  "projects": {
    "graphql-prisma": {
      "schemaPath": "prisma/datamodel.prisma",
      "includes": [
        "**/*.graphql",
        "**/*.gql"
      ],
      "excludes": [
        "temp/**"
      ],
      "extensions": {
        "endpoints": {
          "dev": "http://localhost:4000"
        }
      }
    }
  }
}

I get the output:

Error - 1:03:39 AM] Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: Cannot read property 'projectName' of undefined
  Code: -32603 

I never made this work. Using the Apollo version now. It does not have the go to definition for server defined schemas but otherwise works nicely.

@tomitrescak I actually did create a repo for exactly this purpose, see here: https://github.com/prismagraphql/vscode-graphql/issues/21#issuecomment-410504763

I’d be keen to know if this repo is working for you and if so which branch (local typescript version or vscode version)

Yes I am. That said, I’m pretty sure think this was related to an old graphql version. Since I updated the graphql version locally as well as globally the error has dissapeared and im getting linting and auto completion for .graphql files but not yet in gql tags. See the gql tag issue as I provided a repository for reproduction.

@tomitrescak What version of graphql or graphql-cli do you have installed globally/locally?