OleVik / grav-plugin-static-generator

Indexing and static generation of Page(s) for Grav.
MIT License
22 stars 1 forks source link

Quick navigation tray tools fail #15

Closed bleutzinn closed 3 years ago

bleutzinn commented 3 years ago

Indexing and archiving both work okay from the CLI. Using "/" as route all pages are processed and the index and HTML files are created in user/data/persist.

However both quick navigation tray tools do not work. They show a "Failed to Create or Save Data" message and the icon(s) then show in red.

I have checked the user and group settings and permission which are fine (all identical on all files/directories). I'm using version 3.1.0 of your plugin with Grav v1.7.15 and Admin v1.10.15 on Linux using Apache.

Since all fields in the config are optional at first I did not change these. When I discovered that the route is not optional on the command line I set route to "/" in the plugin UI as well. But that didn't help.

What am I missing?

OleVik commented 3 years ago

Do you get any more specific error in /logs/grav.log or the browser's console? There is a possible limitation if the server refuses to use Server Sent Events, but that should be revealed by the logs. The route used to be an optional parameter, but now it should fall back to root - "/" - if it's not set, to capture all Page(s).

bleutzinn commented 3 years ago

Upon using the Store Index Data tool the Grav log file reports success: [2021-05-23 12:11:13] grav.INFO: Stored 308 items in <omitted path>/user/data/persist/index.js in 0.27 sec.

Indeed a new file index.js is created in user/data/persists which starts with: const GravMetadataIndex = [{"title":"Scholar","date":"2021-05-22T10:38:07+00:00","url":...

The console log does report problems.

The first is a warning: DevTools failed to load SourceMap: Could not load content for https://<route omitted>/user/plugins/admin/themes/grav/js/simplebar.esm.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

This is rather strange since the DevTools Plugin isn't installed.

Secondly there's this error message:

site-generator.admin.js?9e452bcfd3:87 Failed to execute task staticGeneratorIndex
Event {isTrusted: true, type: "error", target: EventSource, currentTarget: EventSource, eventPhase: 2, …}
bubbles: false
cancelBubble: false
cancelable: false
composed: false
currentTarget: EventSource
    onerror: null
    onmessage: null
    onopen: null
    readyState: 2
    url: "https://<omitted route>/admin.json/task:staticGeneratorIndex/admin-nonce:b794d59994b48383ac19bc14aa735c20?mode=index&route="
    withCredentials: false
    __proto__: EventSource
    defaultPrevented: false
    eventPhase: 0
    isTrusted: true
path: []
    length: 0
    __proto__: Array(0)
    returnValue: true
srcElement: EventSource
    onerror: null
    onmessage: null
    onopen: null
    readyState: 2
    url: "https://<omitted route>/admin.json/task:staticGeneratorIndex/admin-nonce:b794d59994b48383ac19bc14aa735c20?mode=index&route="
    withCredentials: false
    __proto__: EventSource
target: EventSource
    onerror: null
    onmessage: null
    onopen: null
    readyState: 2
    url: "https://<omitted route>/admin.json/task:staticGeneratorIndex/admin-nonce:b794d59994b48383ac19bc14aa735c20?mode=index&route="
    withCredentials: false
    __proto__: EventSource
    timeStamp: 17916.39499994926
    type: "error"
    __proto__: Event
(anonymous) @ site-generator.admin.js?9e452bcfd3:87
error (async)
staticGeneratorEventHandler @ site-generator.admin.js?9e452bcfd3:86
(anonymous) @ site-generator.admin.js?9e452bcfd3:319
OleVik commented 3 years ago

The first error is from Chrome's own DevTools, which emanates from the Admin-plugin missing a source-map file. This is more a notice than an error, as you'd usually compile those assets without the reference to the source-map.

The second error is correctly reported, it just doesn't reveal much about why it was thrown. Were there no PHP-errors relating to the Static Generator? I'll check to see if something broke with the newer version of Admin.

bleutzinn commented 3 years ago

It appears that the issue does not arise when I run a copy of the site on localhost using the Grav built-in webserver. I know it should have been the other way around: develop on localhost and then deploy on a live server.

So it must be something related to the shared hosting environment I'm using. Sorry to have bothered you with this. Thanks for the help.

OleVik commented 3 years ago

If you discover what on the hosting environment causes this, please let me know. I'd like to ensure that the plugin is applicable across as many contexts as possible.

bleutzinn commented 3 years ago

As I'm not able to view the PHP error log files with my hosting plan I created a request to my hosting provider to send me the log files. As soon as I've received the log files I'll post any relevant error messages in this issue.

BTW a summary of what Grav reports under Tools - Reports is:

bleutzinn commented 3 years ago

The support department has answered my ticket. Though I can't get to the PHP log files via ssh all PHP errors are logged in a file in the directory in which a PHP script fails. Support staff and I have looked in the plugin directory tree but there's no such file created in there.

Just now I again used the indexing tray icon tool and then checked the entire Grav site directory. Still no error file in there. So it seems the problem does not raise an exception in PHP.

The Grav log just shows: [2021-05-24 10:32:04] grav.INFO: Stored 308 items in /home/<path omitted>/user/data/persist/index.js in 2 sec.

I don't know what else to check. If I encounter anything useful in the future I'll let you know.

Thanks!