MX Lookup issues with Webhooks since last update

Hi there, since last update (2024.11.08-d383b033), there are issues with Webhooks, everything was working well, but now, it fails with transient failure :
{"type":"TransientFailure","id":"XXXXXXXXXXXXX","sender":"","recipient":"","queue":"queue-name","site":"","size":582,"response":{"code":451,"enhanced_code":{"class":4,"subject":4,"detail":4},"content":"failed to resolve queue queue-name: MX lookup for queue-name failed after 2.482µs: NXDOMAIN","command":null},"peer_address":null,"timestamp":1731517059,"created":1731516399,"num_attempts":0,"bounce_classification":"routing-errors","egress_pool":null,"egress_source":null,"source_address":null,"feedback_report":null,"meta":{},"headers":{},"delivery_protocol":null,"reception_protocol":"LogRecord","nodeid":"XXXXXXXXXX"}

add an entry to your shaping config to prevent it from being considered for mx rollup:

[queue-name] # eg: something.log_hook
mx_rollup = false

Hi @free-spirited-yorksh I applied these changes to be 100% sure that this is working :
1/ Created a new webhook-test where I can do anything by using that doc: https://docs.kumomta.com/userguide/operation/webhooks/?h=hook#using-the-log_hookslua-helper
2/ Adding these lines to my shaping.toml file :
["webhook_test.log_hook"] mx_rollup = false
3/ Checking my shaping rules :
/opt/kumomta/sbin/validate-shaping /opt/kumomta/etc/policy/shaping.toml OK
4/ Restarting Kumo and wait for 1 minute (my TTL for tsa_init)
And here is the log line :
{"type":"TransientFailure","id":"REDACTED","sender":"REDACTED","recipient":"REDACTED","queue":"webhook-test.log_hook","site":"","size":1028,"response":{"code":451,"enhanced_code":{"class":4,"subject":4,"detail":4},"content":"failed to resolve queue webhook-test.log_hook: MX lookup for webhook-test.log_hook failed after 8.25µs: NXDOMAIN","command":null},"peer_address":null,"timestamp":1731588629,"created":1731588629,"num_attempts":0,"bounce_classification":"routing-errors","egress_pool":null,"egress_source":null,"source_address":null,"feedback_report":null,"meta":{},"headers":{},"delivery_protocol":null,"reception_protocol":"LogRecord","nodeid":"REDACTED"}

Here is the code for the Webhook:

log_hooks:new {
name = ‘webhook-test’,
log_parameters = {
headers = { ‘From’, ‘Subject’ },
},
queue_config = {
retry_interval = ‘1m’,
max_retry_interval = ‘20m’,
},

– The constructor is called when kumod needs to initiate
– a new connection to the log target. It must return
– a connection object
constructor = function(domain, tenant, campaign)
– Define the connection object
local connection = {}

-- Create an HTTP client
local client = kumo.http.build_client {}

-- The send method is called for each log event
function connection:send(message)
  local response = client
    :post('https://URL')
    :header('Authorization', 'PASSWORD')
    :header('Content-Type', 'application/json')
    :body(message:get_data())
    :send()

  local disposition = string.format(
    '%d %s: %s',
    response:status_code(),
    response:status_reason(),
    response:text()
  )

  if response:status_is_success() then
    return disposition
  end

  kumo.reject(500, disposition)
end

-- The close method is called when the connection needs
-- to be closed
function connection:close()
  client:close()
end

return connection

end,
}

In the shaping file you just want the name of the hook.

[queue-name] 
webhook-test
mx_rollup = false

I think the error you are seeing is because you have an ordering issue with your get_queue_config or get_egress_path_config event handlers wrt. your log hook definition. Move your log_hooks:new so that it occurs before any other potential queue config setup

Thanks @free-spirited-yorksh it has solved the issue… I’ve rewrote my hooks from kumo.configure_log_hook (in init) + kumo.on(‘should_enqueue_log_record’, function(msg, hook_name) + kumo.on(‘make.webhook’, function(domain, tenant, campaign) to log_hooks:new and review my init.lua to follow the order from https://docs.kumomta.com/userguide/configuration/example/