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.

Multiple definitions for query

See original GitHub issue

Do you mind taking a look at this starter? I am getting the error show below in vscode-apollo, and I’m not sure if I should start here, or with vscode-apollo. It almost seems like it could be happening because the query exists in the image component, as well as in plugin-documents.graphql.

image

I’ve noticed this same error in other repositories, and from time to time it will make the plugin crash. Disabling one or the other of

// apollo.config.js
        includes: [
            `${__dirname}/src/**/*.{ts,tsx}`,
            `${__dirname}/.gatsby/graphql/plugin-documents.graphql`,
        ], // eslint-disable-line graphql/template-strings

will fix the error, but then I don’t get full support from the plugin.

If this is not an issue caused by a conflict between gatsby-plugin-typegen and vscode-apollo, or a misconfiguration, but is instead an issue solely with vscode-apollo, then I will open an issue there.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
Js-Brechtcommented, Feb 28, 2020

Can you try again on the latest version? (v1.1.1)

Same problem.

I think I have found one issue:

  console.log(path.resolve(basePath, 'src'));
  console.log(trackedSource.keys());
  process.exit(0);

  const pluginDocuments = Object.values(emitPluginDocuments).some(Boolean) && (
    stripIndent(
      Array.from(trackedSource.entries())
        .filter(([componentPath]) => !componentPath.startsWith(path.resolve(basePath, 'src')))
        .map(([, source]) => source.rawSDL)
        .join('\n'),
    )
  );

will return

D:\dev\source\gatsby\gatsby-starter-pnpm-ts\src
[Map Iterator] {
  'D:/dev/source/gatsby/gatsby-starter-pnpm-ts/src/components/seo.tsx',
  'D:/dev/source/gatsby/gatsby-starter-pnpm-ts/src/layouts/main.tsx',
  'D:/dev/source/gatsby/gatsby-starter-pnpm-ts/src/components/image.tsx',
  'D:/dev/source/gatsby/gatsby-starter-pnpm-ts/node_modules/.pnpm/registry.npmjs.org/gatsby-transformer-sharp/2.3.13_04195f47e3c92d97e09f933485bf4df6/node_modules/gatsby-transformer-sharp/src/fragments.js' }

So, path.resolve() is returning non-posix compliant paths on Windows, while the trackedSource entries are (semi) posix compliant.

If I change that section to normalize componentPath:

  const pluginDocuments = Object.values(emitPluginDocuments).some(Boolean) && (
    stripIndent(
      Array.from(trackedSource.entries())
        .filter(([componentPath]) => !path.normalize(componentPath).startsWith(path.resolve(basePath, 'src')))
        .map(([, source]) => source.rawSDL)
        .join('\n'),
    )
  );

I get the desired results

1reaction
Js-Brechtcommented, Mar 8, 2020

I will copy the conversation to a new issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Definition Queries on the same Data Sourc...
Support for multiple definition queries associated with a layer is only available in Pro (starting 2.3 release). When you have a layer with ......
Read more >
Filter features with definition queries—ArcGIS Pro
A layer can have multiple definition queries associated with it, but only one definition query can be active at a time. Even with...
Read more >
There are multiple definitions for the operation and ... - GitHub
I'm updating from 1.10.0 to 1.17.0. I changed the build script phase to use the new Apollo CLI.
Read more >
mysql select view_definition returns multiple definitions
I am trying to get view definition query for a given view in the database. SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.
Read more >
Definitions | Query and analyze data - Mode Support
A Definition is a saved SELECT statement that can be referenced in other SQL queries. Definitions allow you to write business logic in...
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