Skip to content

Remote Schema Merging/Routing Issue with Unique Namespaces in Hasura 2.44 #10717

Open
@doudian719

Description

@doudian719

Description

I'm encountering an unexpected behavior with Hasura version 2.44 when registering multiple remote schemas originating from different Kubernetes namespaces. I have two remote schemas configured:

Namespace A: Contains a remote API registered with a unique root field namespace and a unique prefix.

Namespace B: An exact copy of Namespace A's API, but deployed under a different Kubernetes namespace with its own unique root field namespace and prefix.

Steps to Reproduce

  1. Configure Remote Schemas:

Register both remote schemas in Hasura with their respective GraphQL server URLs.

For each schema, set a unique prefix and root field namespace that includes the respective Kubernetes namespace information.

Enable the “Forward client headers” option.

  1. Test the APIs:

Use Postman (or another GraphQL client) to send queries to the Hasura endpoint.

Query a field that exists only in the Namespace B API (an extra field added specifically in Namespace B to help identify the routing).

Observe that the query intended for Namespace B returns an error indicating the field is missing—signifying that the request is actually routed to Namespace A's API.

  1. Observations:

An introspection query against Hasura’s merged schema shows that Namespace B's definitions are mixed with those from Namespace A.

When the Namespace A remote schema is removed from the Hasura console, the Namespace B API works as expected without any routing issues.

Expected Behavior

Each remote schema should be isolated using its root field namespace and unique type prefixes. This isolation should ensure that:

Queries intended for Namespace B are routed to its corresponding backend service.

There is no overlapping or merging of the GraphQL type definitions from Namespace A into Namespace B’s schema.

Actual Behavior

When both remote schemas are registered:

The introspection result shows that Namespace B's schema includes definitions from Namespace A.

Queries targeting Namespace B are being routed to Namespace A’s backend service, resulting in errors (e.g., missing fields unique to Namespace B).

Additional Context

Both remote schemas have their GraphQL Server URLs correctly configured.

The schemas are almost identical, with the only difference being an extra field in Namespace B’s schema for testing.

It appears that when remote schemas have similar type definitions, Hasura's stitching logic might be merging them—even with unique prefixes and namespaces set.

The “Forward client headers” option is enabled, although this should not impact routing decisions.

Questions

Is this behavior (i.e., merging definitions or misrouting between remote schemas with similar structures) intended, or is it a known bug in Hasura 2.44?

If it is a bug, are there any recommended workarounds or configuration changes (beyond using unique prefixes/namespaces) to properly isolate remote schema definitions?

Any insights or suggestions on how to avoid this schema merging/routing conflict would be greatly appreciated.

Thanks in advance for your assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions