hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.2k stars 2.77k forks source link

Remote schema permissions lead to conflicting data type name error #10558

Open claudiuman opened 1 month ago

claudiuman commented 1 month ago

Version Information

Server Version: 2.44.0

Environment

Cloud

What is the current behaviour?

Whenever I try to grant permissions on remote schema, I get the following error because there is a conflict between datatypes on Action with data types on Remote schema (I renamed datatypes on remote-schema on graphql side, but Hasura doesn't seem to see that when granting permissions. Anyway, the admin role see's the changes, so it works there! {1E0D4097-3998-4429-AD45-68957515385B}

What is the expected behaviour?

No error

How to reproduce the issue?

  1. Add an Action with some data type (SubmissionStatusEnum)
  2. Add a remote-schema with same datatype but renamed (SubmissionStatusEnum_gbo) (I used @graphql-mesh/transform-rename to rename on graphql-side, and yes, it does work, I was looking through the files and it is renamed in all of the places)
  3. Start the Hasura and add permissions
  4. You should see the error of conflict between the two datatypes

Screenshots or Screencast

Reloading schema: Payload {BD8249D5-6A2E-421E-9A03-991371A56ACC} Reloading schema: Response {EA4F89DD-28C5-4AA4-B0FB-94E83C6C3571}

Please provide any traces or logs that could help here.

If after the above changes I try to restart the container, I get the following error "Found conflicting definitions for GraphQL type 'SubmissionStatusEnum'. The definition at query_root.getMeterReadErroredSubmissions.readingSubmissions.meterReadingStatusType differs from the definitions at [query_root.backoffice.getErroredReadingSubmissions.GetErroredReadingSubmissionsResponse.readingSubmissions.meterReadingStatusType].\nFormer has definition:\nenum SubmissionStatusEnum {CONTACT_NEEDED \n ERROR \n PENDING \n REMOVED \n SUBMITTED \n}\nLatter has definition:\n\"The type of the meter reading submission\" \nenum SubmissionStatusEnum {CONTACTED \n ERROR \n MANUAL_SUBMISSION \n NO_ACTION_REQUIRED \n PENDING \n SUBMITTED \n}","path":"$","code":"unexpected"}

Any possible solutions/workarounds you're aware of?

Sometimes it works when I reload schema.... I do not understand why. Sometimes it fails when I run the Hasura container to apply metadata.

I know that we can use the namespace to rename all the types, but that has another unresolved Hasura issue https://github.com/hasura/graphql-engine/issues/10485

Keywords

remote-schema agent permission issue, Found conflicting definitions for GraphQL type