1

I've downloaded and run the Collabora/Code docker image using the following:

    docker run -t -d -p 127.0.0.1:9980:9980 -e "domain=localhost" -e "username=admin" -e "password=S3cRet" -e --restart always collabora/code

I've also created a local WOPI API that exposes the 4 required endpoints, and I can hit those successfully in the browser/Postman/etc. Whenever I try to access Collabora with a document specified I get the following error:

URL: http://localhost:9980/loleaflet/7151e02/loleaflet.html?WOPISrc=http://localhost:5001/wopi/files/test123

    VM682:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1
        at JSON.parse (<anonymous>)
        at PostMessageReadyListener (loleaflet.html?WOPISrc=http://localhost:5001/wopi/files/test:23)

Viewing that code in dev tools shows it's failing on the JSON.parse() line. The e.data object isn't a string, and it also doesn't include a MessageId property.

      window.WOPIpostMessageReady = false;
      var PostMessageReadyListener = function(e) {
        if (!(e && e.data))
            return;
        var msg = JSON.parse(e.data);
        if (msg.MessageId === 'Host_PostmessageReady') {
          window.WOPIPostmessageReady = true;
          window.removeEventListener('message', PostMessageReadyListener, false);
        }
      };

Is this an issue with Collabora? Something I didn't configure correctly?

user1380769
  • 277
  • 1
  • 4
  • 16

1 Answers1

0

In my case, the SyntaxError you write about does also occur in a working environment. My problem was a missing entry in config/security/wopi/host, maybe you need to add

<host desc="allow localhost." allow="true">localhost</host>
André B.
  • 669
  • 5
  • 8