CSInterface constructor causes SyntaxError: Unexpected end of JSON input
I'm working on a Premiere Pro panel extension and occasionally we've seen users experience an error simply when the CSInterface constructor is invoked. Specifically it is from this line in the version of the library we are using.
this.hostEnvironment = window.__adobe_cep__ ? JSON.parse(window.__adobe_cep__.getHostEnvironment()) : null;SyntaxError: Unexpected end of JSON input
The error makes it sound like the json string provided from the getHostEnvironment method is just malformed, though when we try to log its value immediately after the error occurs, window.__adobe_cep__.getHostEnvironment() is undefined. (Note that if this value was always undefined, JSON.parse would instead throw "SyntaxError: Unexpected token u in JSON at position 0.")
It's difficult to troubleshoot this further since any useful information would come from CSInterface which cannot be instantiated.
Has anybody seen this before or have any thoughts about what might be going on?