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.

Hi, trying to get some help, slowly getting there. 😉

I took your basic example, combining local and remote. It works really neat -but then I started to change the implementation

I simplified to two remote schemas, and the implementation is done with prisma and nexus.

When I stick the two, I get in igraphql

{
  "errors": [
    {
      "message": "Type PartyAccount must define one or more fields."
    },
    {
      "message": "Type Product must define one or more fields."
    }
  ]
}

I checked my code 20 times, replaces introspection with an sdl query. still the same result.

I trapped the fetch call… my two schemas are pulled properly as:

[server:start:gateway] >>>> SDL
[server:start:gateway] ### This file was generated by Nexus Schema
[server:start:gateway] ### Do not make changes to this file directly
[server:start:gateway] 
[server:start:gateway] scalar DateTime
[server:start:gateway] 
[server:start:gateway] type PartyAccount {
[server:start:gateway]   avatar: String
[server:start:gateway]   createdAt: DateTime!
[server:start:gateway]   id: String!
[server:start:gateway]   lastSeen: DateTime!
[server:start:gateway]   updatedAt: DateTime!
[server:start:gateway]   username: String!
[server:start:gateway] }
[server:start:gateway] 
[server:start:gateway] type Query {
[server:start:gateway]   me: PartyAccount
[server:start:gateway]   partyAccounts(
[server:start:gateway]     """
[server:start:gateway]     list of accounts
[server:start:gateway]     """
[server:start:gateway]     users: [String!]!
[server:start:gateway]   ): [PartyAccount]
[server:start:gateway]   sdl: String
[server:start:gateway] }
[server:start:gateway] 
[server:start:gateway] >>>> SDL
[server:start:gateway] fetching from http://localhost:4002
[server:start:gateway] >>>> SDL
[server:start:gateway] ### This file was generated by Nexus Schema
[server:start:gateway] ### Do not make changes to this file directly
[server:start:gateway] 
[server:start:gateway] scalar DateTime
[server:start:gateway] 
[server:start:gateway] type Product {
[server:start:gateway]   createdAt: DateTime!
[server:start:gateway]   name: String!
[server:start:gateway]   price: Float!
[server:start:gateway]   upc: String!
[server:start:gateway]   updatedAt: DateTime!
[server:start:gateway] }
[server:start:gateway] 
[server:start:gateway] type Query {
[server:start:gateway]   products(
[server:start:gateway]     """
[server:start:gateway]     list of accounts
[server:start:gateway]     """
[server:start:gateway]     upcs: [String!]!
[server:start:gateway]   ): [Product]
[server:start:gateway]   sdl: String
[server:start:gateway] }
[server:start:gateway] 
[server:start:gateway] >>>> SDL

Still the stitching doesn’t work…

Then I came across your example with nexus, there is commented code which says:

        // Or:
        //
        // resolve(buildSchema(data._sdl, { assumeValidSDL: true }));
        //
        // `assumeValidSDL: true` is necessary if a code-first schema implements directive
        // usage, either directly or by extensions, but not addition of actual custom
        // directives. Alternatively, a new schema with the directives could be created
        // from the nexus schema using:
        //
        // const newSchema = new GraphQLSchema({
        //   ...originalSchema.toConfig(),
        //   directives: [...originalSchema.getDirectives(), ...allStitchingDirectives]
        // });
        //

Do you think this applies to the above? I am thinking that it could be the DataTime scalar that breaks the schema parsing.

Just asking if you ever had similar issues,

Sincerely,

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
gmaccommented, Jan 25, 2021

Btw, you don’t need those janky “IGNORE” comments with mergedTypeOptions to select preferred element definitions anymore, I actually removed that demo from the handbook recently. See https://www.graphql-tools.com/docs/stitch-type-merging#canonical-definitions

0reactions
gmaccommented, Jan 25, 2021

The real issue comes from the typeMergingOptions: {} construct - if I just comment it out, the types are properly constructed - with fields!

Hu, interesting. The way you had your type merging options looks generally correct at a glance, but something must have been off in there. That was the first thing I removed as well… When in doubt, simplify for the MVP. 😃 Anywho, good riddance to the manual mergers. The @canonical directive came about after building that example and recognizing what a poor development experience it is. If you ever want to know your code’s shortcomings, just document it. It’ll tell you!

Glad you’re up and running.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trichotillomania (Hair Pulling) (for Teens) - Nemours KidsHealth
Trichotillomania is a strong habit that causes people to pull out their own hair. They may pull hairs from their scalp, eyebrows, eyelashes,...
Read more >
Trichotillomania (Hair Pulling): What It Is, Causes & Treatment
Trichotillomania is a mental health condition where you compulsively pull out your own hair. It often has severe negative effects on your mental...
Read more >
Trichotillomania (hair pulling disorder) - NHS
Trichotillomania, also known as trich, is when someone cannot resist the urge to pull out their hair. They may pull out the hair...
Read more >
What Is Trichotillomania? WebMD Explains Hair Pulling
Trichotillomania is an irresistible urge to pull out hair. WebMD takes a look at this mental health disorder.
Read more >
More Than a Fidget: Living with a Hair-Pulling Disorder
Trichotillomania (trich), as defined by the Mayo Clinic, is “a mental disorder that involves recurrent, irresistible urges to pull out hair from your...
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