I haven't been on that exact situation, but close. It has happened to me when I was hired to do X (as an specialist) and that changed substantially when the project got binned after 4 months and was asked to change language and stack. I wasn't as proficient as I would have liked and wasn't really excited about it.
I don't know if this applies to you, so please remember this is an stranger on the Internet sharing an experience and not advice.
In my case if is just a project, I get on with it because when is done I can move to something more exciting or inspiring and that's my motivation to move forward. If it is just what I can expect of that role from that point on, I look for a change (move to a different team perhaps, or just change jobs).
It also helps me if I can do something different at home, in my free time. It has to be challenging and exciting, because otherwise the negative mood from work can take over and nothing will happen (and may make things worse; e.g. guilt for not working on that personal project).