Streaming to generic HTTP Endpoint JSON Issue #2235

Open
opened 2025-11-20 07:06:19 -05:00 by saavagebueno · 0 comments
Owner

Originally created by @nulluserid on GitHub (Aug 28, 2025).

Bug Report: Webhook meta field contains Go map syntax instead of JSON object after body template modification

Issue
When NetBird sends webhook events after modifying the webhook body template to include custom fields (specifically adding NB_Tenant), the meta field contains Go map syntax as a string value instead of a proper JSON object, making it difficult to parse programmatically.

Trigger Condition
This issue occurs after modifying the webhook body template in NetBird console. The problem was not present with the default webhook body but appeared when customizing the webhook payload to include additional fields like:
{
"id": "{{.Event.ID}}",
"timestamp": "{{.Event.Timestamp}}",
"message": "{{.Event.Message}}",
"initiator_id": "{{.Event.InitiatorID}}",
"target_id": "{{.Event.TargetID}}",
"meta": "{{.Event.Meta}}",
"NB_Tenant": "custom_tenant_value"
}

Expected Behavior
{
"meta": {
"destination_addr": "10.0.1.5:8266",
"received_timestamp": "2025-08-28T23:31:16.312Z",
"source_addr": "100.100.241.38:61767"
}
}

Actual Behavior
{
"meta": "map[destination_addr:10.0.1.5:8266 received_timestamp:2025-08-28 23:31:16.312662603 +0000 UTC source_addr:100.100.241.38:61767]"
}

Problems

  1. Go map syntax: "map[key:value ...]" instead of JSON object
  2. HTML entities: Plus signs encoded as + instead of +
  3. Timestamp format: Go format instead of ISO 8601
  4. Parsing complexity: Requires custom Go map parser instead of standard JSON

Environment
• NetBird version: [your version]
• Webhook content-type: application/json (correct)
• Overall JSON structure: Valid (only meta field is problematic)
• Occurred after: Modifying webhook body template to add custom fields

Expected Fix
When using {{.Event.Meta}} in webhook body templates, ensure the meta field is serialized as a proper JSON object rather than Go's string representation of a map.

Originally created by @nulluserid on GitHub (Aug 28, 2025). Bug Report: Webhook meta field contains Go map syntax instead of JSON object after body template modification Issue When NetBird sends webhook events after modifying the webhook body template to include custom fields (specifically adding NB_Tenant), the meta field contains Go map syntax as a string value instead of a proper JSON object, making it difficult to parse programmatically. Trigger Condition This issue occurs after modifying the webhook body template in NetBird console. The problem was not present with the default webhook body but appeared when customizing the webhook payload to include additional fields like: { "id": "{{.Event.ID}}", "timestamp": "{{.Event.Timestamp}}", "message": "{{.Event.Message}}", "initiator_id": "{{.Event.InitiatorID}}", "target_id": "{{.Event.TargetID}}", "meta": "{{.Event.Meta}}", "NB_Tenant": "custom_tenant_value" } Expected Behavior { "meta": { "destination_addr": "10.0.1.5:8266", "received_timestamp": "2025-08-28T23:31:16.312Z", "source_addr": "100.100.241.38:61767" } } Actual Behavior { "meta": "map[destination_addr:10.0.1.5:8266 received_timestamp:2025-08-28 23:31:16.312662603 +0000 UTC source_addr:100.100.241.38:61767]" } Problems 1. Go map syntax: "map[key:value ...]" instead of JSON object 2. HTML entities: Plus signs encoded as + instead of + 3. Timestamp format: Go format instead of ISO 8601 4. Parsing complexity: Requires custom Go map parser instead of standard JSON Environment • NetBird version: [your version] • Webhook content-type: application/json (correct) • Overall JSON structure: Valid (only meta field is problematic) • Occurred after: Modifying webhook body template to add custom fields Expected Fix When using {{.Event.Meta}} in webhook body templates, ensure the meta field is serialized as a proper JSON object rather than Go's string representation of a map.
saavagebueno added the feature-requesttriage-needed labels 2025-11-20 07:06:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#2235