Looks like a possible issue with intermediate certificate. Was working fine in browser but command line but complaining that t could not validate the certificate issue. Recreating cert with updated intermediate resolves the problem for me.
Got there in the end, despite the rather cryptic error message.