Loading failed for the <script> with source “https://*/index.php/js/core/merged-template-prepend.js

Install Details:

Nextcloud version (eg, 12.0.2): 13.0.4
Operating system and version (eg, Ubuntu 17.04): [Don’t know how to check this]
Apache or nginx version (eg, Apache 2.4.25): [Don’t know how to check this]
PHP version (eg, 7.1): 7.1

Issue Description:

I am self hosting a NextCloud install on a Dreamhost server. Recently, they required me to create a new user, which triggered some script on their end to move the files to another directory on their servers. Since then, my Nextcloud instance is completely unavailable. I have tried to fix it with them, they are of no help whatsoever.

So I would like to know if anyone could provide me any help on how to fix this. The files are all there, the databases are all accessible, but nothing works. See https://docs.jansensan.net.

[Thu Jan 31 15:00:02 2019] [error] [client 216.112.17.10] 
{"reqId":"XFN98tBx2fEAAAtAYJUAAAAL","level":3,"time":"2019-01-31T23:00:02+00:00","remoteAddr":"216.112.17.10","user":"--","app":"PHP","method":"GET","url":"\\/","message":"fileperms(): 
stat failed for 
\\/home\\/jansensan\\/docs.jansensan.net\\/data\\/nextcloud.log at 
\\/home\\/jansensandocs\\/docs.jansensan.net\\/lib\\/private\\/Log\\/File.php#136","userAgent":"Mozilla\\/5.0 
(X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) 
Chrome\\/53.0.2785.143 Safari\\/537.36","version":"13.0.4.0"} 
[Thu Jan 31 15:00:02 2019] [error] [client 216.112.17.10] 
{"reqId":"XFN98tBx2fEAAAtAYJUAAAAL","level":3,"time":"2019-01-31T23:00:02+00:00","remoteAddr":"216.112.17.10","user":"--","app":"PHP","method":"GET","url":"\\/","message":"chmod(): 
Permission denied at 
\\/home\\/jansensandocs\\/docs.jansensan.net\\/lib\\/private\\/Log\\/File.php#137","userAgent":"Mozilla\\/5.0 
(X11; Linux x86_64) AppleWebKit\\/537.36 (KHTML, like Gecko) 
Chrome\\/53.0.2785.143 Safari\\/537.36","version":"13.0.4.0"} 

At this point I am completely blocked, and I see no other solution than to reinstall the whole damn thing, which is not interesting to me whatsoever.

Any help would be appreciated, I would love to love FOSS, but when crazy things like these happen, I am less interested.

Thanks in advance for any guidance.
-m.

The problem seems to be your log file. Check the permissions!

Thanks for replying quickly @JABAHOSTING. The current permissions are 644, and the original install were 640. I tried switching them to 640 and tested, to no avail. Should they have had another value?

Wait, looking at your line, it makes me realize that it is pointing to an old directory. Are there paths saved somewhere within Nextcloud that could be hardcoded and pointing to a wrong location after the files were moved?

Nextcloud create the log file into the datadirectory. Have you change the datadirectory in the config.php?

Is the owner of the Log file correct?

Ok so I went to config.php, corrected that part, it’s moving forward a bit. Things appear on-screen.

Looking at the browser console, there are multiple errors.

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). [files:1:1](https://docs.jansensan.net/index.php/apps/files/)

Loading failed for the &lt;script&gt; with source “https://docs.jansensan.net/index.php/js/core/merged-template-prepend.js?v=b83073ec-3”. [files:45:1](https://docs.jansensan.net/index.php/apps/files/)

Loading failed for the &lt;script&gt; with source “https://docs.jansensan.net/index.php/js/notifications/merged.js?v=b83073ec-3”.

etc.

This kind of error happens when a domain tries to load files from another domain, which is not the case here… Is this something about permissions? Those files are 644 at this time.

Where is your datadirectory? Is it in your docroot?

It’s at /home/jansensandocs/ and the install is at /home/jansensandocs/docs.jansensan.net/. I am unable to go to the /home/ directory, as my users do not have that permission.

You have php openbasedir active? If yes, what is you openbasedir?

I think that the Webserver does not have access to /home/jansensandocs/ only in /home/jansensandocs/docs.jansensan.net/.

If you dont know, what I mean change the datadirectory back to /home/jansensandocs/docs.jansensan.net/

I don’t know what is “php openbasedir” Where can I find this?

At this time all the files are at the proper place of /home/jansensandocs/docs.jansensan.net/. There are issues with loading files even though they are there…

http://blog.dreamhosters.com/kbase/index.cgi?area=2526

Ok this seems to be about trying to load files outside of the directory of the user, which is not the current case. All the files of the install are at the proper location.

The issues that the browser is spitting is because it cannot load files. These errors would happen if for example https://domain123.com is trying to load files from https://domainabc.com. But in this case, all files are on the same domain, under the proper install directory.

Would there be an entry in the error logs if the open_basedir is the cause of those errors?

Normal yes, like this ->PHP Warning: Unknown: open_basedir restriction in effect.

There was nothing like that.

The browser throws an error:

Loading failed for the <script> with source “https://docs.jansensan.net/index.php/js/core/merged-template-prepend.js?v=b83073ec-3”.

That URL makes no sense, why would there be a directory called “index.php”?

I am still unable to figure out what this issue is, nor can I find documentation about it. These are the current errors (in the browser console) that I am facing:

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). [login:1:1](https://docs.jansensan.net/index.php/login)

Loading failed for the &lt;script&gt; with source “https://docs.jansensan.net/index.php/js/core/merged-share-backend.js?v=b83073ec-3”. [login:25:1](https://docs.jansensan.net/index.php/login)

Loading failed for the &lt;script&gt; with source “https://docs.jansensan.net/index.php/js/core/merged-login.js?v=b83073ec-3”. [login:32:1](https://docs.jansensan.net/index.php/login)

JQMIGRATE: Migrate is installed, version 1.4.0 [core.js:7:542](https://docs.jansensan.net/core/vendor/core.js?v=b83073ec-3)

Loading failed for the &lt;script&gt; with source “https://docs.jansensan.net/index.php/apps/theming/js/theming?v=3”. [login:54:1](https://docs.jansensan.net/index.php/login)

Source map error: request failed with status 500 Resource URL: https://docs.jansensan.net/core/vendor/core.js?v=b83073ec-3 Source Map URL: purify.min.js.map[Learn More]

Any guidance to help me fix this issue is greatly appreciated. At this time, I cannot log into the NextCloud install at all.

Is this the policy set by Nextcloud or an additional one? (just thinking loud).

In case you have a special theme or some “exotic” app, I’d try to disable this first and see if it helps. Perhaps an app or something is using some absolute paths it generated upon activation. But that is all wild guessing.

Or with the new server, perhaps something on their configuration has changed…

Content Security Policy is something a server app sets when it returns files so that only the same server can load files. As I have not changed this, and as there is no way my host (Dreamhost) has changed that, I can only conclude that the problem comes from NextCloud.

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”). [login:1:1](https://docs.jansensan.net/index.php/login)

Loading failed for the <script> with source “https://docs.jansensan.net/index.php/js/core/merged-template-prepend.js?v=43bb0505-3”. [login:23:1](https://docs.jansensan.net/index.php/login)

Loading failed for the <script> with source “https://docs.jansensan.net/index.php/js/core/merged-login.js?v=43bb0505-3”.

I have tried upgrading the server, which seemed to work until it gave an error at code integrity check. The errors above are still visible.

At this time, I cannot go through login. Since my only option is to delete everything, I would appreciate some guidance as to how I can backup my calendar so that I can use it with another service. I don’t think I am interested in working with this server anymore, too much time invested, too much of a risk to lose important data.

Thanks in advance for any help regarding backing up my calendar.

If you have shell access to your server, you might be able to use my script calcardbackup to backup your calendar (this depends on the Operating system of the server).

If you don’t have shell access to this server, but you have shell access to another server (running linux), where you could import a database dump from the broken installation: then you also could backup your calendar with the same script (have a look at the section “does this work with a broken instance” in the README).

Thanks for this, I hadn’t seen this answer. I will investigate this.