I am using azure-storage node module.
I would like to send JSON on my queue and get it into my queue on azure function.
I send message in queue. I stringify my message to put in queue.
// This is my service who send message to queue via node lib azure-storage
const queueMsg = {
userId,
token: tokenNotif
};
queueSvc.createMessage(Config.REGISTRATION_FCM_PUSH_NOTIFICATION_QUEUE, JSON.stringify(queueMsg), (err) => {
if (!error) {
this._logger.info(`User ${userId} has register this push notification token`);
resolve(true);
} else {
reject(false);
}
});
And in the queue function i have an error because the function think isn't a string and push the message text on xx-queue-poison
{"userId":"a6c8a103-dacc-4b15-bffd-60693105f131","token":"xxxx"}
I don't know why the quote is replaced by ASCII code on queue ?
I have tested something else! From my service i call a Http Azure function, and this function call the Queue Storage and it's work by this way :s ..
The HttpTrigger function call queue
context.bindings.notificationQueue = [{ userId: name, token }];
And queue received data
context.log(`Received userId ${queueItem.userId} :: ${queueItem.token}`);
Why by using HttpTrigger function to QueueTrigger function it's working, but when i am using the lib "azure-storage" is not working ?
Thx
Buffer.from(JSON.stringify(queueMsg)).toString('base64')and it's working