return Mono.defer(() -> principalMapper.map(context))
.switchIfEmpty(Mono.just(context.principal()));
to
return Mono.defer(() -> principalMapper.map(context))
Let client worry about what to return in the mapper. Don't make scalecube to "fallback" something if it was null.