I just had a similar issue and same error message so thought I'd comment here for anybody else that searches for this later. I declared some variables using "let" but the API version was set to 2.x. NetSuite doesn't like that so I had to either change it to "var", or force the API version of the client script to be 2.1. Either way resolved the issue.