Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Axel8555 opened this issue Apr 11, 2025 · 1 comment
Labels

Comments

@Axel8555
Copy link

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
@Axel8555 Axel8555 added the k/bug Something isn't working label Apr 11, 2025
@robertjdominguez
Copy link
Contributor

Thanks for this @Axel8555!

I'm tagging the relevant folks and adding the appropriate label(s) for us to triage.

cc @codedmart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants