Open itair-miguel opened 5 years ago
@mathewc @brettsam Would somebody be able to have a look at this issue?
Hmmm, perhaps related to https://github.com/Azure/azure-webjobs-sdk/pull/2211. Can you try setting an "application/json" content type on the message if it isn't already being specified?
@mathewc I'm using @azure/service-bus to send message. I set contentType
on SendableMessageInfo
to "application/json"
and it didn't change anything :(
Workaround:
sender.send({
messageId: "...",
partitionKey: "...",
scheduledEnqueueTimeUtc: ...,
body: { ... }
})
Have been wrestling with the same problem for some time. Running an express-server that communicates with a couple of .NET-microservices through the service bus. Everything worked great until trying to schedule a message.
As I need to be able to cancel my messages, sender.send() is not a solution. I did manage to find my body hidden deep within the object in the .NET-service though, so if anyone else has the same problem, here is the solution that worked for me:
object body = message.SystemProperties
.GetType()
.GetProperties(BindingFlags.NonPublic | BindingFlags.Instance)
.Single(prop => prop.Name == "BodyObject")
.GetValue(message.SystemProperties, null);
I'm mainly a nodejs-developer so if someone more comfortable in C# wanna improve on that code, please do!
I seem to be having this problem too, sending a scheduled message through the queue client and then recieving an empty mySbMsg object in the srvice bus function (same azure functions project).
Seems odd this doesn't work, makes the whole service bus queue trigger useless, it's effectively broken and should be a higher priority to fix surely?
Then again there's still no way to delete queued messages using the nodejs sdk so clearly the whole library is an afterthought..
Hey @itair-miguel,
Very sorry for the late response. The issue is caused by a bug in the service-bus JS SDK.
Cause - Expected encoding was not being done in the scheduleMessage()
method as opposed to the send()
method.
While the issue occurred with the Azure Function Triggers, it is not the case when received the message with Receiver.registerMessageHandler()
from the JS SDK, which is the reason why the bug wasn't discovered till now.
Workaround
DefaultDataTransformer
from "@azure/amqp-common"
library.
In typescript, import { DefaultDataTransformer } from "@azure/amqp-common";
In javascript, const { DefaultDataTransformer } = require("@azure/amqp-common");
scheduleMessage()
method to send the message as follows
const dt = new DefaultDataTransformer();
message.body = dt.encode(message.body);
Please look at https://github.com/Azure/azure-sdk-for-js/issues/6816#issuecomment-574461068 for more reference.
Also responded at the issue that you have created here - https://github.com/Azure/azure-sdk-for-js/issues/2144 More Reference and Investigation around the bug - https://github.com/Azure/azure-sdk-for-js/issues/6816#issuecomment-574461068
/cc - @AlexZhidkov @mathewc @yann-h @ninjavang @meds
When sending a scheduled message to service bus queue, when the message is passed on to the queue itself and an Azure Function is triggered (Service Bus Queue Trigger) the message is
undefined
.Repro steps
I am using https://github.com/Azure/azure-sdk-for-js for sending messages to the queue:
Receiving it on an azure function:
Expected behavior
mySbMsg
should not beundefined
Actual behavior
When the function is triggered
mySbMsg
isundefined
:bindings: Object {mySbMsg: undefined}
Known workarounds
Putting my message on the
label
as in:Allows me to read the message from:
Related information
Also opened this issue on #https://github.com/Azure/azure-sdk-for-js/issues/2144 and was suggested that I opened it up here as well as it might be a problem on the service bus trigger itself not being able to do the binding in a proper way.