superdesk / web-publisher

Superdesk Publisher - the next generation publishing platform for journalists and newsrooms.
GNU Affero General Public License v3.0
96 stars 56 forks source link

Error loading Publisher Settings in Superdesk #1100

Open alejandrogj opened 4 years ago

alejandrogj commented 4 years ago

Hi!

I have linked Superdesk with Publisher but when i click "Publisher Settings" in Superdesk i get a never-ending loading screen. The console prints out this error

Possibly unhandled rejection: {"data":null,"status":-1,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"http://192.168.0.165/api/v2/auth/superdesk/","data":{"session_id":"5eaa70bb30f3daa24f877668","token":"Basic MTI5YzQwNGItNzUwNS00YjEyLWI3MDYtMTUzMTIzODM3NGIzOg=="},"add_format":"json","headers":{"Authorization":"Basic undefined","Accept":"application/json, text/plain, */*","Content-Type":"application/json;charset=utf-8"}},"statusText":"","xhrStatus":"error"}

It seems there is something wrong whent trying to access to http://192.168.0.165/api/v2/auth/superdesk/

Publisher is installed and working in http://192.168.0.165:8000

My superdesk.config.js

module.exports = function(grunt) {
    return {
        defaultRoute: '/workspace/personal',

        view: {
            timeformat: 'HH:mm',
            dateformat: 'DD.MM.YYYY'
        },

        features: {
            preview: 1,
            swimlane: {columnsLimit: 4},
            noTakes: true,
            editor3: true,
            validatePointOfInterestForImages: false,
            editorHighlights: true,
            noPublishOnAuthoringDesk: true,
            noMissingLink: true
        },
    apps: ['superdesk-publisher'],
    importApps: ['superdesk-publisher'],
    publisher: {
            protocol: 'http',                /* http or https */
            tenant: '',                      /* tenant - semantically subdomain, '' is allowed */
           domain: '192.168.0.165',           /* domain name for the publisher */
           base: 'api/v2',                  /* api base path */

           wsProtocol: 'wss',                /* ws or wss (websocket); if unspecified or '' defaults to 'wss' */
           wsDomain: '192.168.0.165',  /* domain name (usually domain as above) */
                                                                          /* e.g.: example.com, abc.example.com */
                                                                          /* tenant, as above, is NOT used for websocket */
           wsPath: '/ws',                    /* path to websocket root dir */
           wsPort: '8080'                    /* if not specified: defaults to 443 for wss, 80 for ws */
    },
    };
};

and the .env.local file in Publisher

SUPERDESK_SERVERS='["192.168.0.164"]'
CORS_ALLOW_ORIGIN=http://192.168.0.164

Thanks!

ahilles107 commented 4 years ago

Hey @alejandrogj 192.168.0.164 is your superdesk server ip? It works without port?

alejandrogj commented 4 years ago

Yes, 192.168.0.164 is the superdesk server ip. It works without port.

I installed superdesk using the installing script (https://raw.githubusercontent.com/superdesk/fireq/files/superdesk/install)

ahilles107 commented 4 years ago

@takeit - any idea here?

mabastaraz commented 4 years ago

@petrjasek @takeit I'm facing the same issue here, any idea?

@alejandrogj did you find anything to solve this?

Screenshot 2020-05-11 at 03 55 34
alejandrogj commented 4 years ago

@mabastaraz not yet :(

NicholasIanni commented 4 years ago

Try assigning a hostname to the servers and then use the hostname instead of IP. I had issues caused because of that. Also, did you have any trouble getting the Publisher tab to come up in Superdesk? If so, what guide did you use? I cannot seem to get it to show up...

UPDATE: Disregard above. Now I am at the same spot where you are at with the infinite loading.

mabastaraz commented 4 years ago

@NicholasIanni Even assigning a hostname to the servers and then use the hostname instead of IP won't solve the problem of the loading screen.

I think it's all related to the configuration of superdesk.config.js inside /opt/superdesk/client, idk maybe I'm wrong!

Screenshot 2020-05-13 at 18 25 05
NicholasIanni commented 4 years ago

@mabastaraz Yeah I realized that :/. Honestly more documentation on the config file would be nice. Out of curiosity did you use the updated script that was posted in the repo's issue area to install?

mabastaraz commented 4 years ago

@NicholasIanni Yes, indeed. I installed both fresh Superdesk and Publisher today. but I have found something interesting,i have tried but didn't work. You can take a look and give us feedback.

https://superdesk-publisher.readthedocs.io/en/latest/cookbooks/developers/websocket.html?highlight=websocket#websocket-communication

NicholasIanni commented 4 years ago

Actually after quickly viewing my side of the console something is trying to access "example.com". There is also an issue reaching whatever is running on port 5100 so I'll also look into that if I have time tonight. I think I'm going to post a working virtual machine image for publisher and Superdesk once I get them working so people don't have to go through this process for demos and stuff.

NicholasIanni commented 4 years ago

So after reading the article you provided and looking into how things are communicating, it seems the issue definitely is surrounding WebSocket. I'm guessing there is a config problem with either the wsProtocol, wsDomain, wsPath, wsPort, or base variable. It seems that even though 8080 is defined as the port, communication is trying to be made over port 5100. I also some reference to api/v2 but I can't seem to find the was or api/v2 directory. I was hoping to deploy SD and Publisher by end of this week but something tells me we are going to have to do some digging here unless an actual dev can lead us in the right direction...Hope this info is of use. I will keep digging in the meantime.

ahilles107 commented 4 years ago

guys - what do You have set as value in SUPERDESK_SERVERS env (in publisher env's)?

ahilles107 commented 4 years ago

Here are the docs for this part: https://superdesk-publisher.readthedocs.io/en/latest/manual/getting_started/superdesk-superdesk-publisher-setup.html#update-your-publisher-configuration-file

mabastaraz commented 4 years ago

@ahilles107

/var/www/publisher/.env.local

.env.local

/opt/superdesk/client/superdesk.config.js

superdesk.config.js
ahilles107 commented 4 years ago

and you did composer symfony:dump-env prod (or dev -if you use dev env)? What's the response for superdesk auth request (dev tools -> tan network) ?

mabastaraz commented 4 years ago

@ahilles107 composer symfony:dump-env prod

composer symfony

superdesk auth request : ws://localhost:5100/

3 2
ahilles107 commented 4 years ago

You should have more in network tab - keep it open and refresh page. There must be some filed request to publisher.

ahilles107 commented 4 years ago

@mabastaraz - it's problem with your publisher instance. http://publisher.kurdishtimes.net/ returns 500 error. Check publisher error log and fix issue ;)

ahilles107 commented 4 years ago

and in cors allow origin env provide that publisher ip address - as you us it instead domain in your browser.

mabastaraz commented 4 years ago

@ahilles107 500 Internal Server Error happens after I run composer symfony:dump-env prod

ahilles107 commented 4 years ago

This not reason but symptoms. Check publisher/php logs to see what's wrong and fix it ;)

mabastaraz commented 4 years ago

@ahilles107 rm .env.local.php

publisher

when I run composer symfony:dump-env prod again

500
ahilles107 commented 4 years ago

Removing computed env's will not help. Like i said - check logs and find out real problem.

NicholasIanni commented 4 years ago

Where are these logs that you are referencing located?

ahilles107 commented 4 years ago

Publisher logs can be found at var/log/ directory inside publisher.

mabastaraz commented 4 years ago

@ahilles107 I'm still facing the same issue after I run composer symfony:dump-env prod and .env.local.php generated, the Sperdesk Publisher will go 500 error.

I have checked publisher logs

root@publisher:/var/log/postgresql# tail postgresql-10-main.log 2020-06-11 18:30:47.684 UTC [31101] root@publisher_prod FATAL: database "publisher_prod" does not exist 2020-06-11 18:30:47.728 UTC [31102] root@publisher_prod FATAL: database "publisher_prod" does not exist 2020-06-11 18:30:47.742 UTC [31103] root@publisher_prod FATAL: database "publisher_prod" does not exist

Just to make sure that i have right information inside /var/www/publisher/.env.local

SUPERDESK_SERVERS='["IP/Domian of Superdesk"]'   ///  IP/Domian of Superdesk
CORS_ALLOW_ORIGIN=http://IP/Domian of Superdesk Publisher  /// IP/Domian of Superdesk Publisher

Also included a screenshot of .env.local.php

1

Thanks for your help :)