Whilst there were discussions and verbal assurances made during the early 1990s, there is no evidence of a formal, legally binding agreement that NATO would not expand eastward.
Depending on your point of view you might argue Russia was conned, and/or Russian leaders were incredibly naive to not formalise these promises in a treaty......or that yes, promises were made at the time....but times change.
The only person who knows the 'truth' as to why he invaded Ukraine...... is Putin himself