Skip to content

Error: Null Validation #153

@dragos-rosca

Description

@dragos-rosca

ctx.message.headers.pubSubTenantId = tenantContext?.tenant?.id

On this line we need to validate that ctx.message.headers exists. Right now we get "Can not set pubSubTenantId of undefined."

suggested fix:

const tenantPublish = async (ctx, next) => {
  const tenantContext = tenantContextAccessor.getTenantContext()
  ctx.message.headers = ctx.message.headers || {}
  ctx.message.headers.pubSubTenantId = tenantContext?.tenant?.id

  return await next()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions