You might try to use the spellid instead of the name.
https://wow.gamepedia.com/API_GetSpellInfo
"Using spellName or spellLink only returns the info if the spell is in your spellbook; otherwise it returns nil."
So perhaps your spellbook is not yet available (event SPELLS_CHANGED should tell you when its loaded).