My guess would be that
context.document.pages().layers() is not a text layer and therefore doesn't have the method
Any particular reason why you're using the native object and not the JS API, like so:
document.pages.layers.style.fontSize = 100?
See fromNative in the API reference.