question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'onType' of undefined

See original GitHub issue

Describe the bug TypeError: Cannot read property ‘onType’ of undefined

To Reproduce Steps to reproduce the behavior: codegen.yml:

schema: 
  - http://localhost:4000/gql
  - src/gql/my-client-schema.graphql
documents: src/gql/**/*.{ts,tsx}
overwrite: true
generates:
  ./src/generated/gqlTypesAndComponents.tsx:
    plugins:
      - time
      - add: "// THIS IS A GENERATED FILE, DO NOT EDIT IT!"
      - typescript-common:
          interfacePrefix: "I"
      - typescript-client
      - typescript-react-apollo

Client schema:

type AuthState {
  authenticated: Boolean
  token: String
}

type Query {
  getAuthState: AuthState
}

type Mutation {
  changeAuthState: AuthState
}

Mutations:

const SET_LOCAL_AUTH_STATE = gql`
  mutation ChangeAuthState {
    changeAuthState @client {
      ...authFragments
    }
  }
  fragment authStateFragment on AuthState {
    authenticated
    token
  }

Queries:

const GET_LOCAL_AUTH_STATE = gql`
  query getAuthState {
    getAuthState @client {
      ...authStateFragment
    }
  }
  fragment authStateFragment on AuthState {
    authenticated
    token
  }
`;

defaults on Apollo:

{
  auth: {
    __typename: 'AuthState',
    authenticated: false,
    token: null
  }
}

Expected behavior To generate TS and React Components

Environment:

  • OS: MacOs Mojave
  • Codegen: 0.15.0
  • Node: v9.11.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zenVentzicommented, Apr 17, 2019

Okay. That.was.fast. Thank you!

1reaction
dotansimhacommented, Apr 17, 2019

@zenVentzi We fixed that in 1.0.7 - now you should get the error and the name of the fragments that caused that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - typeerror: Cannot read properties of undefined ...
Here BoderList function maping OldList Component. But React says me typeerror: Cannot read properties of undefined (reading 'handelChangeName') ...
Read more >
Uncaught TypeError: Cannot read property 'onBlur' of ... - GitHub
The onChange prop is managed by react-hook-form-auto. I will take steps to avoid the problem if that's the case. Not very important, but...
Read more >
onChange script error: TypeError: Cannot read property 'value ...
When you insert an assessment template into the attestation related list of the Vendor record. We get an onChnage Client Script Error message....
Read more >
How to Fix TypeError: Cannot read Property 'push' of ...
You call the method on a variable previously set to undefined . You call the method on a variable before it has been...
Read more >
React TypeError: Cannot read property function of undefined
SET YOUR LIKE THERE ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found