X-KumoRef duplicate header

Hello - we submit all of our messages into a kumo instance via inject API and wanted to add some meta fields to the kumoref. After changing the init.lua to add the meta to the ref, our sent messages now include 2 kumoref headers, one that includes the fields plus the default, one that only is the default. I can pass more information privately but here’s a snippet of our init.lua which adds the trace fields in:

kumo.on('http_message_generated', function(msg)

  local failed = msg:check_fix_conformance(
    -- check for and reject messages with these issues:
    'NON_CANONICAL_LINE_ENDINGS',
    -- fix messages with these issues:
    'LINE_TOO_LONG|NAME_ENDS_WITH_SPACE|NEEDS_TRANSFER_ENCODING|NON_CANONICAL_LINE_ENDINGS|MISSING_DATE_HEADER|MISSING_MESSAGE_ID_HEADER|MISSING_MIME_VERSION'
  )
  if failed then
    kumo.reject(552, string.format('5.6.0 %s', failed))
  end
  -- Call the queue helper to set up the queue for the message.
  --msg:set_meta('queue', 'relaydomain')
  msg:import_scheduling_header 'X-Schedule'

  local dbm_batchid = msg:get_first_named_header_value 'X-DBM-BatchID'
  if dbm_batchid then
    msg:set_meta('dbm-batchid', dbm_batchid)
  end

  local dbm_emailid = msg:get_first_named_header_value 'X-DBM-EmailId'
  if dbm_emailid then
    msg:set_meta('dbm-emailid', dbm_emailid)
  end

  kumo.apply_supplemental_trace_header(msg, {
    include_meta_names = {
      'dbm-batchid',
      'dbm-emailid'
    }
  })

  queue_helper:apply(msg)
  -- SIGNING MUST COME LAST OR YOU COULD BREAK YOUR DKIM SIGNATURES
  dkim_signer(msg)
end)

Take a look at https://docs.kumomta.com/reference/http/api_inject_v1/#trace_headers

the default value for trace_headers.supplemental_header is true, so the handling of the injection will add one to satisfy that, then your explicit kumo.apply_supplemental_trace_header will add another one.

I’d suggest adding a call to msg:remove_all_named_headers('X-KumoRef') prior to your kumo.apply_supplemental_trace_header so that you’re adding the one you want in code there, regardless of the parameters in the injection request.

oooohhhh

so i can just adjust my api req to submit the include meta

that’s actually even better

yeah, that’s the other option: remove the code from the lua and just set it the way you want in the injector

i mean either or really works good for us

but ok that makes sense, remove before add

luckily only one batch of sends went out with the duplicated header, it’s not really here nor there and didnt affect deliverability, setting up for some future changes

thanks for the help! changing the injection payload worked great