Error in upgrading OJS 3.0.2 to OJS 3.1.1

#20

I’m sorry, I don’t know how else to help. If you’d like to send me the entire error log file via PM, I’ll search for any fatal errors (they’re easy to miss with all the warning messages).

#21

@NateWr

I have discovered why nothing is in the server logs: the error is occuring in my browser as it executes javascript. Look for “api_submissions_unknownError” in js/build.js; there is code there for issuing this message.

To prove this theory, I edited js/build.js by changing the variable $.pkp.locale.api_submissions_unknownError into the literal string “BLAHBLAH”. Sure enough, the popup error message now says “BLAHBLAH”.

Looking again at that point in build.js, the code there is doing something related to the modalHandler — recall from above that I see 2 or 3 javascript errors in js/modalHandler.js at exactly the same time as the ##api.submissions.unknownError## message pops up.

I strongly suspect that the way to make the error popup disappear is to fix the errors in modalHandler.js.

#22

@bdm, api_submissions_unknownError is the error message that the JavaScript code will display when it encounters an error it doesn’t know how to handle. This usually indicates that an ajax request to the server has failed. You’re correct that the error message is triggered in the JavaScipt, but it usually indicates a problem on the server.

#23

@NateWr I spent 7-8 minutes clicking between the menus in the journal manager’s view (i.e Submissions, Issues, Settings, Users&Roles, Tools and Administration). The error pop appeared many times and the common situation between all of them was being in the Submissions area then leaving, either to one of the other admin sections, Settings.Website, or even to “View Site” or logout.

Contrary to what I thought before, it is not specific to Settings.Journal. Moving from Submissions to anywhere triggers it. Even being in Submissions and clicking again on Submissions triggers the error.

I could not trigger the error on leaving one of the other admin sections, for example leaving from Administration. I only managed it by leaving Submissions.

Before doing this, I set PHP’s reporting level to “everything” and restarted the web server (which began a new error log). After finishing, I made a copy of the error log. You can have a copy if you like, but I can tell you it has only:

  1. The web server startup message.
  2. One ssl error triggered by someone in another country.
  3. About 250 lines similar to “[Sat Apr 14 13:05:51.943824 2018] [php7:warn] [pid 21056] [client MYIPNUMBER:54400] PHP Warning: Declaration of PKPUsageEventPlugin::getEnabled() should be compatible with LazyLoadPlugin::getEnabled($contextId = NULL) in /usr/local/share/ojs/lib/pkp/plugins/generic/usageEvent/PKPUsageEventPlugin.inc.php on line 0, referer: https://MYJOURNALURL/…”

If you can think of some code that gets executed at the moment of leaving the Submissions area, I’m happy to insert some debugging code into it. At the moment I don’t even know where to look.

Thanks, Brendan.

#24

Hi Brendan,

Unfortunately, I’m not familiar with any code that would be triggered on leaving a page. If you can send me by private message the error log I’ll take a look and see if I can spot anything unusual, but I don’t have many ideas at this point…

#25

Hi guys,

I´m having the same problem. Anyone found the solution?

The ##api.submissions.unknownError## occur when the is restful_urls changed in config.inc.php to On. If restful_urls = Off no error occur.

Thanks,
Geucimar

[Solved] Custom domain error ##api.submissions.unkownError## on OJS3.1.1
Pictures and ##api.submissions.unknownError## [3.1.1.2 OJS]
Ojs 3.1 upgrade issue
#26

The restful_urls = On remove the index.php between localhost/ and /journal and this causes the 404 error.

http://localhost//journal/api/v1/submissions?status=1&assignedTo=-1&searchPhrase=&count=20&offset=0&=15299993396

When I put index.php manually in the request it works fine.

http://localhost/index.php/journal/api/v1/submissions?status=1&assignedTo=-1&searchPhrase=&count=20&offset=0&=15299993396

I don’t know how to repair this error in jQuery request. Could someone help me?

#27

Hi @Gecuimar,

When restful_urls = On the index.php should be removed from all of your requests. If it’s not, you’re probably missing the .htaccess configuration you need to run with restful_urls = On.

#28

I’m using htaccess too. But, when I enable restful_urls, submissions URL returns the error, if I disable everything works fine.

#29

@NateWr @Gecuimar Alas, the same problem occurs for me whether or not restful_urls is On. But the restful_urls option works as advertised.

#30

@Gecuimar, I notice that http://localhost//journal/ includes a double slash (//). Maybe that’s the issue? Can you try removing any ending slash from your base_url to see if that helps?

#31

Hi, @NateWr and @bdm,

My base_url is correct:

base_url = http://localhost
base_url[index] = http://localhost
base_url[journal] = http://localhost

I’ve checked that the restfulUrlsEnabled condition in function getApiUrl of file js/build.js is a bit confusing.

The condition removes the index.php page from api url http://localhost//journal/api/v1/_submissions and the ajax request produces the error message ##api.submissions.unknownError##.

The solution is to maintain the “index.php” still when restfulUrls are enabled.

getApiUrl: function(t) {
var e, n = “index.php”; // $.pkp.app.restfulUrlsEnabled ? “” : “index.php”;
return e = $.pkp.app.contextPath ? “/” + $.pkp.app.contextPath + $.pkp.app.apiBasePath : $.pkp.app.apiBasePath, $.pkp.app.pathInfoEnabled ? $.pkp.app.baseUrl + “/” + n + e + “/” + t : $.pkp.app.contextPath ? $.pkp.app.baseUrl + “/” + n + “?journal=” + encodeURIComponent($.pkp.app.contextPath) + “&endpoint=” + e + “/” + t : $.pkp.app.baseUrl + “/” + n + “?endpoint=” + e + “/” + t
}

#32

Hi @Gecuimar,

The removal of the index.php with restful_urls enabled is intentional; see the config.inc.php note on the restful_urls setting and associated entry in docs/FAQ.

Regards,
Alec Smecher
Public Knowledge Project Team

#33

Hi @asmecher,

I’m sure of this, but when using mod_rewrite to work with a single journal without contextPath, this condition causes the error message ## api.submissions.unknownError ##.

The change above is a solution that works for me.

#34

Hi @Gecuimar,

Hmm, I don’t know whether directing both base_url[index] and base_url[journal] to the same place will cause problems.

However, I suspect the problem is that the mod_rewrite rules that you’re using to remove both index.php and the journal path aren’t behaving properly. I’d suggest backing off to just removing the index.php, making sure everything works, then considering the removal of the journal path second.

Regards,
Alec Smecher
Public Knowledge Project Team

#35

I’ve configured the htaccess so:

<IfModule mod_rewrite.c>
# enable rewrites
RewriteEngine On

# redirect everthing ^$ to http://localhost/home
# then point home to http://localhost/index
RewriteCond %{HTTP_HOST} ^localhost$
RewriteRule ^$ http://localhost/home [NC,L,R=301]
RewriteRule ^home$ http://localhost/index [NC,L]
# output: http://localhost/home

# input: http://localhost/issue/archive
# change /issue/archive to /issues
# then point /issues to /issue/archive
RewriteCond %{THE_REQUEST} /issue/archive [NC]
RewriteRule ^issue/archive$ /issues [R=301,L,NC]
RewriteRule ^issues$ /issue/archive [NC,L]
# output: http://localhost/issues

# input: http://localhost/index
# change /index to /home
# then point /home to /index
RewriteCond %{THE_REQUEST} /index [NC]
RewriteRule ^index$ /home [R=301,L,NC]
RewriteRule ^home$ /index [NC,L]
# output: http://localhost/home

# select all composed %{DOCUMENT_ROOT}%{REQUEST_URI} 
# ^(.*)$ to $1 and redirect to /index.php/journal/$1
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/journal/$1 [NC,L]

</IfModule>

#36

The getApiUrl function is easier to read in its pre-built format here: https://github.com/pkp/ui-library/blob/master/src/mixins/global.js#L89-L113

In particular, it looks like the URL that’s being generated is causing // to appear between localhost and journal:

http://localhost//journal/api/v1/_submissions

Can you try correcting that (change localhost//journal to localhost/journal) and then try loading the URL directly in your browser to see if it works?

If it does, then we can update the getApiUrl function to account for this. If it doesn’t work, then @asmecher is probably on the right track here.

[Solved] Problems with api submissions error on submissions page
#37

Dear @NateWr @Gecuimar and others
I have the same problem. See also my post: Problems with api submissions error on submissions page

I guess it is an error in the code. None of my changes in .htaccess files works!

An answer to @NateWr 's question:

I tried removing the double “/” and that does not work!
This is the link that OJS tries to access:
https://domain.sub.se//jounralX/api/v1/_submissions?status=1&searchPhrase=&count=20&offset=0&_=1550044118374
-> causes 500 Internal Server Error :frowning_face:
This:
https://domain.sub.se/jounralX/api/v1/_submissions?status=1&searchPhrase=&count=20&offset=0&_=1550044118374
-> causes 500 Internal Server Error :frowning_face:
However only:
https://domain.sub.se/index.php/jounralX/api/v1/_submissions?status=1&searchPhrase=&count=20&offset=0&_=1550044118374
-> causes 200 OK!:grinning:

[Solved] Problems with api submissions error on submissions page
#38

I made the following changes in /js/build.js (OJS 3.1.1.4):

from:
getApiUrl:function(t){var e,n=$.pkp.app.restfulUrlsEnabled?"":"index.php";
to:
getApiUrl:function(t){var e,n=$.pkp.app.restfulUrlsEnabled?"index.php":"index.php";

Now it works!

1 Like
[Solved] Problems with api submissions error on submissions page
#39

Now I solved this issue in another way, by making changes in the Apache settings.