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.

Strawberry Shake 13 - Generating client when schema has JSON scalar causes error

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Product

Strawberry Shake

Describe the bug

Generating client when schema has JSON scalar causes error

After upgrading to version 13.0.4, I’m getting the following error…

Error GQL: An item with the same key has already been added. Key: JSON

31>_GenerateGraphQLCode: dotnet “C:\WINDOWS\ServiceProfiles\NetworkService.nuget\packages\strawberryshake.server\13.0.4\build..\tools\net6\dotnet-graphql.dll” generate “D:\agents\agent02_dev_pr_work\2\s\GrowFlow.ArcClient” -o “D:\agents_work\2\s\ArcClient\obj\Release\netstandard2.0\berry” -n GrowFlow.ArcClient -a md5 -t Generate C# Clients started. Generate ArcClient started. Generate ArcClient completed in 332 ms

I do have a JSON scalar type in my schema defined…

“The JSON scalar type represents JSON values as specified by ECMA-404.” scalar JSON

Removing the JSON scalar type from the schema fixes the build issue (edited)

Steps to reproduce

  1. Create new strawberry shake client
  2. Use the schema provided below
  3. Wire up SS client to schema
  4. Build project
  5. Get Error

schema { query: Query mutation: Mutation }

type ApiRequest{ nodeId: ID! id: Int! body: JSON }

“The JSON scalar type represents JSON values as specified by ECMA-404.” scalar JSON

Relevant log output

Error GQL: An item with the same key has already been added. Key: JSON
31>_GenerateGraphQLCode:
         dotnet "C:\WINDOWS\ServiceProfiles\NetworkService\.nuget\packages\strawberryshake.server\13.0.4\build\..\tools\net6\dotnet-graphql.dll" generate "D:\agents\agent02_dev_pr\_work\2\s\GrowFlow.ArcClient" -o "D:\agents\_work\2\s\ArcClient\obj\Release\netstandard2.0\berry" -n GrowFlow.ArcClient -a md5 -t
         Generate C# Clients started.
         Generate ArcClient started.
         Generate ArcClient completed in 332 ms

Additional Context?

No response

Version

13.0.4

Issue Analytics

  • State:open
  • Created 7 months ago
  • Comments:11

github_iconTop GitHub Comments

4reactions
clazarevcommented, Jun 27, 2023

Hi, I think I found the root cause of this issue. I’m creating a PR soon

1reaction
rlincoln24commented, Apr 14, 2023

First time using this package and I thought this was just me the entire time.

Also having this exact same issue. Was able to Generate the demo with no issues but see this when I go to build:

1>EXEC : error GQL: An item with the same key has already been added. Key: JSON

Hopefully there is a fix soon, kinda stuck 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

StrawberryShake generator gets confused over raw json in ...
Once the problem is incorrect processing of 'scalar JSON' in the schema the workaround is to remove (or comment out) in schema.graphql the ......
Read more >
EXEC : error GQL: An item with the same key has already ...
The process is failed with exact the same message when the schema contains 'scalar JSON'. Here are the details and the workaround described....
Read more >
Scalars - Strawberry Shake
A scalar has two representation: the runtimeType and the serializationType . The runtimeType refers to the type you use in your dotnet ...
Read more >
[SOLVED] Possible wrong data type in graphql schema
The Client in my .NET Project produces the error message: “SS0002 de returns a scalar value. Selections on scalars or enums are never...
Read more >
Incorrectly reported errors when using Strawberry Shake library
When using the Strawberry Shake GraphQL library from ChilliCream, Rider will mark auto-generated types with red squiggly lines because it finds them 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