userKey returned in scanAll for Aerospike is null

I am trying to scan an entire set in Aerospike, but in the callback function I am getting key.userKey as null.

I have tried making both writePolicy.sendKey = true and scanPolicy.sendKey = true but all in vain

I have the most recent AS java client version. (3.1.5)

Sample from put function:

        WritePolicy writePolicy = new WritePolicy();
        writePolicy.expiration = ABC;
        writePolicy.timeout = XYZ;
        writePolicy.sendKey = true;


Here is an example that works GitHub - helipilot50/store-primary-key

Try it out and see if you still have a problem