Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message headers not available to node trigger functions #119

Open
ryangies opened this issue Nov 18, 2020 · 8 comments
Open

Message headers not available to node trigger functions #119

ryangies opened this issue Nov 18, 2020 · 8 comments

Comments

@ryangies
Copy link

The context.bindingData.basicProperties is coming across as its class name instead of its object data (as expected). Because of this, node workers don't have access to the message basicProperties.headers.

Node trigger function:

module.exports = async function(context, message) {
  context.log(JSON.stringify(context.bindingData, null, 2));
  context.done();
}

Output:

{
  "invocationId": "0ec6358b-6e68-4671-bd8c-e014b34ff89c",
  "consumerTag": "amq.ctag-0_dfcTHAvX8XmH-uao1uMA",
  "deliveryTag": 1,
  "redelivered": {
    "json": "false",
    "data": "json"
  },
  "exchange": {
    "string": "",
    "data": "string"
  },
  "routingKey": "testQueue1",
  "basicProperties": "RabbitMQ.Client.Framing.BasicProperties",         <-- HERE
  "body": {
    "type": "Buffer",
    "data": []
  }
}

Comparable trigger for dotnet (which works correctly):

[FunctionName("trigger_with_args")]
public static void Trigger_BasicDeliverEventArgs(
    [RabbitMQTrigger("testQueue2", ConnectionStringSetting = "rmqConnctionString")] BasicDeliverEventArgs args,
    string consumerTag, ILogger logger)
{
    logger.LogInformation($"RabbitMQ queue trigger function processed message: {Encoding.UTF8.GetString(args.Body)} and headers: {args.BasicProperties.Headers}");
}

Output

RabbitMQ queue trigger function processed message: {"dummy":"123456789"} and headers: System.Collections.Generic.Dictionary`2[System.String,System.Object]

Setup notes

  • v3.x of Core Tools
  • .NET Core 3.1 SDK
@teebu
Copy link

teebu commented Nov 3, 2022

any progress on this? still seeing "basicProperties": "RabbitMQ.Client.Framing.BasicProperties",

@JatinSanghvi
Copy link
Contributor

Hi @teebu, are you using the 2.x version of the RabbitMQ extension? I remember we had this issue for .NET isolated function apps, which was fixed with 2.x. If not, it would be quicker for me to take a look if you can provide a sample application that reproduces the issue.

@teebu
Copy link

teebu commented Nov 7, 2022

How do i check the version of the rabbitMQ extension? I am using whatever comes without making any modifications or custum installs.

func start:

Azure Functions Core Tools
Core Tools Version:       4.0.4590 Commit hash: N/A  (64-bit)
Function Runtime Version: 4.5.2.18383

@JatinSanghvi
Copy link
Contributor

I think you are getting the RabbitMQ extension through extension bundle which has the major version of extension set to 1.x. We are not allowed to increment the major version of RabbitMQ extension to 2.x in existing bundles and we need to wait for next major version of the bundle to be released. We have initiated discussion internally on how to get around this limitation.

Can you try installing the RabbitMQ extension directly by following this documentation section?. I haven't tried it out myself but the command to install would be something similar to below. Make sure that you save (cache or commit) your project before running the command:

func extensions install --package Microsoft.Azure.WebJobs.Extensions.RabbitMQ --version 2.0.3

Let me know if the extension install fails, or if the issue persists even after that and we will try reproducing the issue on our side.

@JatinSanghvi
Copy link
Contributor

BTW, here is the other issue that I think is related and was fixed in v2.x: #173

@JatinSanghvi
Copy link
Contributor

Hi @teebu, did upgrading the RabbitMQ extension solve the problem? Sorry for following up late on this.

@teebu
Copy link

teebu commented Dec 17, 2022

I haven't yet.

@niwrA
Copy link

niwrA commented Nov 13, 2024

Actually, your dotnet example version doesn't work for me either. I get the eventargs, but the basicproperties remains empty. Whereas when I manually look at the message in RabbitMQ management, the reply-to property is set, and this is one that I absolutely need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants