Skip to content

Aggregate subscriptions return partially stringified JSON responses on MSSQL databases #10716

Open
@Axel8555

Description

@Axel8555

Version Information

Server Version: v2.46

Environment

OSS (Docker Compose setup)

What is the current behaviour?

When performing a GraphQL subscription on an MSSQL aggregate table, the response is partially stringified instead of being a proper JSON object.

Specifically, the aggregate result returns a JSON-encoded string rather than a structured JSON object.

For example, executing the following subscription:

subscription MySubscription {
  myTable_aggregate {
    aggregate {
      count
    }
  }
}

Results in:

{
  "data": {
    "myTable_aggregate": "{\"aggregate\":{\"count\":0}}"
  }
}

This issue occurs only with subscriptions. Regular queries behave correctly.

What is the expected behaviour?

The subscription should return a structured JSON object as queries do, for example:

{
  "data": {
    "myTable_aggregate": {
      "aggregate": {
        "count": 0
      }
    }
  }
}

How to reproduce the issue?

  1. Set up Hasura v2.46 with MSSQL using Docker Compose following [Hasura MSSQL Docker Guide](https://hasura.io/docs/2.0/databases/ms-sql-server/getting-started/docker/).
  2. Manually connect MSSQL database with driver string:
    Driver={ODBC Driver 18 for SQL Server};Server=tcp:mssql,1433;Database=tempdb;Uid=sa;Pwd=Password1;Encrypt=optional
    
  3. Create and track the following table manually via Hasura console SQL section:
    CREATE TABLE myTable
    (
        id int NOT NULL PRIMARY KEY,
        name varchar(100)
    );
  4. Manually track the newly created table via Hasura's Data section
  5. Run the above subscription and observe the stringified JSON result.
  6. Run the same aggregation query (non-subscription) to confirm it works correctly.

Screenshots or Screencast

The subscription returns a partially stringified response:
Image

The query behaves as expected.
Image

Keywords

  • aggregate subscriptions
  • MSSQL Server subscriptions
  • aggregate stringified response
  • String encoded response
  • JSON stringifiedresponse

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions