How to summon entity on victim while in offhand, custom enchantment

I'm trying to make an equipment that uses a custom enchantment to summon a lightning bolt on the victim while the equipment is in your offhand, but I've only been able to make it work when it's in mainhand, any way to make this work?

The enchantment:

    "description": "Lightning Strike",
    "supported_items": "minecraft:ghast_tear",
    "weight": 1,
    "max_level": 1,
    "min_cost": {
      "base": 0,
      "per_level_above_first": 0
    },
    "max_cost": {
      "base": 0,
      "per_level_above_first": 0
    },
    "anvil_cost": 0,
    "slots": [
      "offhand"
    ],
    "effects": {
      "minecraft:post_attack": [
        {
          "enchanted": "attacker",
          "affected": "victim",
          "effect": {
            "type": "minecraft:summon_entity",
            "entity": "minecraft:lightning_bolt"
          }
        }
      ]
    }
  }```
Continue to help post