That’s because you’re doing
[spoiler]https://i.imgur.com/zJ4M8Fx.jpg[/spoiler]
instead of
[spoiler]
https://i.imgur.com/zJ4M8Fx.jpg
[/spoiler]
URLs need to start and be on their own line to onebox
EDIT
Sorry. Now I see what you mean. The URL should show beneath the spoiler without it trying to onebox and fail.