graphql-platform
graphql-platform copied to clipboard
Interface type subscriptions throw an error: The topic already exists with a different message type.
Product
Hot Chocolate
Version
13.8.1
Link to minimal reproduction
https://github.com/grounzero/hcsubscriptions/
Steps to reproduce
-
Run the repro project and visit https://localhost:7015/graphql/
-
Subscribe to
BookUpdated
with the following arguments:
subscription BookUpdated {
bookUpdated(id: "2") {
... on PagesBook {
title
author {
name
}
pages
}
... on AnotherBook {
title
author {
name
}
another
}
}
}
- Run
AddPagesBook
with the following arguments:
mutation AddPagesBook {
addPagesBook(
input: { id: "2", author: { name: "name" }, pages: 100, title: "title1" }
) {
title
author {
name
}
pages
}
}
- Run
AddAnotherBook
with the following arguments which throws an exception which can occur in eitherAddPagesBook
orAddAnotherBook
mutation depending on which id value is passed toBookUpdated
subscription.
InvalidMessageTypeException: 'The topic already exists with a different message type. Topic message type: hcsubscriptions.Types.Book. Requested message type: hcsubscriptions.Types.AnotherBook.'
mutation AddAnotherBook {
addAnotherBook(
input: {
id: "3"
author: { name: "name" }
another: "another"
title: "title2"
}
) {
title
author {
name
}
another
}
}
What is expected?
The subscription should return the appropriate interface implementation
What is actually happening?
An exception is thrown:
InvalidMessageTypeException: 'The topic already exists with a different message type.
Topic message type: hcsubscriptions.Types.Book.
Requested message type: hcsubscriptions.Types.AnotherBook.'
Relevant log output
No response
Additional context
No response