Skip to content
This repository has been archived by the owner on Sep 20, 2022. It is now read-only.

Cannot read property 'map' of undefined (link issue with undefined variableDefinitions) #68

Open
tylermenezes opened this issue Jun 29, 2020 · 0 comments

Comments

@tylermenezes
Copy link

I'm not able to call link without getting the error "Cannot read property 'map' of undefined" in graphql-tools AddArgumentsAsVariables (in addVariablesToRootFields, which calls operation.variableDefinitions.map()).

The issue seems to originate from here -- https://github.com/AEB-labs/graphql-weaver/blob/master/src/pipeline/links.ts#L301 -- if I change undefined to [] that solves the error.

I've tried it with graphql-tools 4.0.0 (from your lock file) and 4.0.4 (the latest in 4.0) and get the same error in both. Quite honestly I don't know nearly enough about GraphQL query evaluation to understand what's causing this.

  const schema = await weaveSchemas({
    endpoints: [
      {
        namespace: 'account',
        typePrefix: 'Account',
        schema: auth0,
      },

      /* Wordpress post schemas */
      {
        namespace: 'blog',
        typePrefix: 'Blog',
        schema: createWordpressSchema('https://wp-int.codeday.org/graphql'),
        fieldMetadata: {
          'User.slug': {
            link: {
              field: 'account.user',
              argument: 'where.username',
              batchMode: false,
              linkFieldName: 'account',
            },
          },
        },
      },
    ]
  });

(auth0 is using makeExecutableSchema({ typeDefs, resolvers }); -- is there something special I'd need to do since it's not a remote schema?)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant