The Warlock is fighting a Ochre Jelly. On his turn, he cast Hex on the Jelly as a bonus action, then hits it with his Short sword. The Ochre Jelly is immune to the slashing damage, so the attack does zero damage regardless of what the Warlock rolls, however is the Hex able to proc, and deal 1d6 necrotic damage to the jelly?
Hex states (PHB p.251):
You place a curse on a creature that you can see within range. Until the spell ends, you deal an extra 1d6 necrotic damage to the target whenever you hit it with an attack. [...]
So although the attack hit, would the Jelly still take the Hex's additional damage when it is immune to the original damage of the attack?