Command blocks don't give any output when using a command it just says there is an error at the end BUT when used in chat it work completely fine
this the command /execute at <playername> at @e run summon minecraft:lightning_bolt ~ ~ ~
this worked in chat but not in the command not impulse command block nor repeat command block
Remove the trailing space from the command, as displayed in the output.