Skip to main content
Participant
November 9, 2022
Answered

CSInterface constructor causes SyntaxError: Unexpected end of JSON input

  • November 9, 2022
  • 2 replies
  • 744 views

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?

This topic has been closed for replies.
Correct answer bbb_999

Haven't heard of this one, before...

Key word in your problem statement = "occasionally". 🙂

What's different/interesting, about the systems on which users have reported this problem? 

2 replies

Participant
November 16, 2022

You might need to wait for the actual CSInterface script to be loaded in your application. I noticed a similar behavior when sometimes calling methods of the CSInterface constructor fail due to the script not fully loaded. 

bbb_999
Community Manager
bbb_999Community ManagerCorrect answer
Community Manager
November 10, 2022

Haven't heard of this one, before...

Key word in your problem statement = "occasionally". 🙂

What's different/interesting, about the systems on which users have reported this problem?