Able to shift to final gear on bike, but not on smart trainer
When it's a 10-speed bike involved in this situation, here is the calculus:

If someone put a cassette spacer on the trainer wider than the proper 1.85mm 10 to 11 speed conversion spacer, it causes this problem because then the small cog is out further than the RD high limit screw is set for it to be.
If the trainer does have a 1.85mm spacer and still doesn't work, and both cassettes have any included 1mm spacers on that they came with, the assumption then becomes the hub is locating the small cog in further than standard, which is why using the techncially right spacer on the trainer is seeming to put the small cog out to far. The solution then becomes use a thinner spacer on the trainer.

Make sure your hanger alignment is perfect.