Open
Description
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?
- 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/).
- 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
- Create and track the following table manually via Hasura console SQL section:
CREATE TABLE myTable ( id int NOT NULL PRIMARY KEY, name varchar(100) );
- Manually track the newly created table via Hasura's Data section
- Run the above subscription and observe the stringified JSON result.
- Run the same aggregation query (non-subscription) to confirm it works correctly.
Screenshots or Screencast
The subscription returns a partially stringified response:
The query behaves as expected.
Keywords
- aggregate subscriptions
- MSSQL Server subscriptions
- aggregate stringified response
- String encoded response
- JSON stringifiedresponse