Hmm, I've never used buttons to carry out full function execution before so can't comment on how that would work .. I have only used secure buttons to execute a spell or ability specified in the creation code.
That said, unless the template your button inherits from inherits from SecureFrame/SecureActionButton etc that might be the problem you are having .. but it may entail looking at this page to see if the properties needed include something you can use.
https://wow.gamepedia.com/SecureActionButtonTemplate