Our Sorcerer wanted to cast a Lightning Bolt as their attack on a monster that had made it into melee with that Sorcerer.
DM said could make the attack, but it would provoke an OA (that would likely kill the sorcerer).
Player argued that as a magic-using character they would be as adept as a Fighter doing a melee attack. The range being Self was integral to the issue. What lies beyond the initial target was not in question. AoE was not relevant.
DM ruled (and yes, whatever he decides is what we go with, I'm here looking for discussion of rules and logic of the situation), that it took enough time summoning the magic that the monster would get a free shot. Player countered that a successful attack would stop the spell anyway.
Player maintained that it was essentially a melee attack he was making as the range was less than 5 feet (starting with the caster) and should not provoke OA.
Which position is correct though? Does casting Lightning Bolt within an enemy's reach provoke an Opportunity Attack?
@Rubiksmoose This question is different enough from your provided generic answered question. Those who are versed in earlier version rules will benefit from the specifics of this question. As well as the specific differentiation between ranged attacks and the lightning bolt characteristics.
Best Answer
Casting spells never provokes an opportunity attack in D&D 5e. See the rules for Opportunity Attacks on the SRD:
That bolded part is the only thing that grants an opportunity attack, and it requires you to move out of reach of an opponent. This makes them work very differently from previous versions. You can freely engage with an enemy through large threat ranges, and move around inside someone's threatened space, as long as you don't leave it.
Spell never provoke, and neither do ranged attacks. You do have Disadvantage on any attack rolls made with ranged attacks and ranged spells while in melee, but that only matters for spells that make any. Lightning Bolt isn't one of them.