Hi guys
I have an API Management service with a Synthetic Graphql API. There, I'm trying to configure my mutations. Resolvers for this mutations are implemented in Azure Functions with the HttpTrigger, meaning that we need to call them by a HTTP call.
We tried with a GET method it works perfect, but we don't like the idea of calling our mutations by a GET request, we want to use a POST request.
My graphql schema looks like this:
schema {
query: Query
mutation: Mutation
}
type Mutation {
SendChatTextMessage(input: SendChatTextMessageInput!): SendChatMessageResp
}
GetUserChatMessages(userId: UUID!): [ChatTextMessage]
}
input SendChatTextMessageInput {
messageId: UUID!
senderUserId: UUID!
receiverUserId: UUID!
messageContent: String!
}
enum Language {
ENGLISH,
SPANISH
}
enum ChatMessageSendStatus {
SUCCESS,
FAIL
}
type ChatMessageErrorData {
code: Int
message: String
}
type SendChatMessageResp {
messageId: UUID!
status: ChatMessageSendStatus!
error: ChatMessageErrorData
}
type ChatTextMessage {
messageId: UUID!
senderUserId: UUID!
receiverUserId: UUID!
messageContent: String!
}
and I defined my Resolber policy like this:
<http-data-source>
<http-request>
<set-method>POST</set-method>
<set-url> [My Azure Function URL] </set-url>
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
var args = context.Request.Body.As<JObject>(true)["arguments"];
JObject jsonObject = new JObject
{
new JProperty("input",
new JObject
{
new JProperty("messageId", args["input"]["messageId"]),
new JProperty("senderUserId", args["input"]["senderUserId"]),
new JProperty("receiverUserId", args["input"]["receiverUserId"]),
new JProperty("messageContent", args["input"]["messageContent"])
}
)
};
return jsonObject.ToString();
}</set-body>
</http-request>
</http-data-source>
when I try to run my mutation, I get the error: Could not test the resolver policy. Please try again later.
Can someone tell me if you have done this before? Cause in this post I saw that it's a known issue from 2022, but I'm not sure if this has been fixed by Microsoft or not.
Any help here please?