Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fresh install Nextcloud Hub 5 (27.0.1) Could not fetch data #42

Closed
leorthur opened this issue Aug 2, 2023 · 20 comments
Closed

fresh install Nextcloud Hub 5 (27.0.1) Could not fetch data #42

leorthur opened this issue Aug 2, 2023 · 20 comments

Comments

@leorthur
Copy link

leorthur commented Aug 2, 2023

Hello

With a fresh installation I got the following error Could not fetch data while trying to display Shifts.

The Administration panel seems to work fine.

192.168.1.92-1691005547492.log
192.168.1.92-1691005562677.log

@csoc-kevink
Copy link
Collaborator

Hey,

did you create the analyst groups and shift calendar like described here: #41 (comment)
If so, can you add the log of the server? It should be somewhere in the data folder in a nextcloud.log file

We will add these setup steps to the ReadMe in the future.

@leorthur
Copy link
Author

leorthur commented Aug 3, 2023

Hello

You are right it is working, need to add it in the readme file.

I have an another instance which is not working and the administration panel for shift isn't working.

May be I will make an another issue for that, i ll try to find out.

@csoc-kevink
Copy link
Collaborator

That the admin settings panel is not loading is strange. Maybe you can send the logs for that if they do not contain sensitiv information?
Or if this instance has no imprtant data you can reset the tables for the shifts app in the database (old data will be lost).

@noci2012
Copy link

noci2012 commented Sep 25, 2023

I have a similar issue with NC 27.1.1, (upgraded from original NC 24, in various steps) Shiftplan was only added after upgrade to v. 27.1.1. -- Shiftplan v 1.9.3

Here the Admin panel is showing "loading..." with the notification: "Could not Fetch Settings" and nothing else happening.
These seem to be relevant messages from install + first activation?

logreader | Could not find resource file "/apps/logreader/css/../js/logreader-main.css" |   | 2023-09-25T11:29:09+0200
-- | -- | -- | --
Debug | PHP | Creation of dynamic property OCA\FirstRunWizard\Settings\Personal::$urlGenerator is deprecated at /var/www/nextcloud/apps/firstrunwizard/lib/Settings/Personal.php#40 |   | 2023-09-25T11:29:08+0200
Debug | PHP | Creation of dynamic property OCA\FirstRunWizard\Settings\Personal::$urlGenerator is deprecated at /var/www/nextcloud/apps/firstrunwizard/lib/Settings/Personal.php#40 |   | 2023-09-25T11:28:48+0200
Debug | no app in context | Deprecated event type for OCP\IDBConnection::CHECK_MISSING_COLUMNS: Symfony\Component\EventDispatcher\GenericEvent is used |   | 2023-09-25T11:28:24+0200
Debug | no app in context | Deprecated event type for OCP\IDBConnection::CHECK_MISSING_INDEXES: Symfony\Component\EventDispatcher\GenericEvent is used |   | 2023-09-25T11:28:22+0200
Debug | no app in context | Deprecated event type for OCP\IDBConnection::CHECK_MISSING_PRIMARY_KEYS: Symfony\Component\EventDispatcher\GenericEvent is used |   | 2023-09-25T11:28:21+0200
Debug | no app in context | 3 well known handlers registered |   | 2023-09-25T11:28:21+0200
Debug | no app in context | 3 well known handlers registered

The next one is about a workflow task running from cron.
The first seems irrelevant, probably from starting the logreader.

Next run:

Debug | logreader | Could not find resource file "/apps/logreader/css/../js/logreader-main.css" |   | 2023-09-25T11:36:40+0200
-- | -- | -- | -- | --
Debug | PHP | Creation of dynamic property OCA\FirstRunWizard\Settings\Personal::$urlGenerator is deprecated at /var/www/nextcloud/apps/firstrunwizard/lib/Settings/Personal.php#40 |   | 2023-09-25T11:36:39+0200
Debug | PHP | Creation of dynamic property OCA\FirstRunWizard\Settings\Personal::$urlGenerator is deprecated at /var/www/nextcloud/apps/firstrunwizard/lib/Settings/Personal.php#40 |   | 2023-09-25T11:36:18+0200
Debug | cron | CLI cron call has selected job with ID 802

Tables are created i think: (these are the ones).

| oc_shifts                                  |
| oc_shifts_cal_changes                      |
| oc_shifts_change                           |
| oc_shifts_type                             |

How to reset tables in the Database? Those are all ready empty.
db:add_missing.... all report all tables are OK.

I n attempt 1 I did create groups (different names), in attempt #3 i create groups "Analyst", "Level 1" and "Level 2"
as litteral name, still no show.
Creating the Analyst et.al. groups is different on the main user screen. Without those groups nothing is show, with those existing a schedule to enter a shiftplan is show. (German language).

@noci2012
Copy link

This is shown in the Browser Console:

Navigated to https://nc.xxxxxxxxxxx/settings/admin/shifts
jquery-migrate.min.js:2 JQMIGRATE: Migrate is installed, version 3.4.1
index.es.js:2337 Proxying an event bus of version 3.1.0 with 1.3.0
e @ index.es.js:2337
68668 @ index.es.js:3314
o @ bootstrap:19
46631 @ requesttoken.js:11
o @ bootstrap:19
44332 @ index.js:25
o @ bootstrap:19
4820 @ index.js:14
o @ bootstrap:19
44312 @ SearchResultPlaceholders.vue:20
o @ bootstrap:19
(anonymous) @ core-unified-search.js?v=f03d350b-8:2
o.O @ chunk loaded:25
(anonymous) @ core-unified-search.js?v=f03d350b-8:2
(anonymous) @ core-unified-search.js?v=f03d350b-8:2
index.es.js:2337 Proxying an event bus of version 3.1.0 with 1.3.0
t @ index.es.js:2337
2089 @ index.es.js:3314
r @ bootstrap:19
1894 @ requesttoken.js:11
r @ bootstrap:19
2200 @ index.js:25
r @ bootstrap:19
4820 @ index.js:14
r @ bootstrap:19
(anonymous) @ filelist.js?v=f03d350b-8:1
(anonymous) @ filelist.js?v=f03d350b-8:1
(anonymous) @ filelist.js?v=f03d350b-8:1
session-heartbeat.js:103 session heartbeat polling started
xhr.js:251     GET https://nc.xxxxxxxxxx/apps/shifts/settings/ 404
(anonymous) @ xhr.js:251
xhr @ xhr.js:49
rt @ dispatchRequest.js:51
request @ Axios.js:148
ge.forEach.dt.<computed> @ Axios.js:174
(anonymous) @ bind.js:5
(anonymous) @ settings.js:68
fetchSettings @ settings.js:67
(anonymous) @ vuex.esm.js:851
p.dispatch @ vuex.esm.js:516
dispatch @ vuex.esm.js:406
fetchSettings @ Settings.vue:239
created @ Settings.vue:364
En @ vue.runtime.esm.js:3017
Ar @ vue.runtime.esm.js:4031
e._init @ vue.runtime.esm.js:5693
o @ vue.runtime.esm.js:5826
(anonymous) @ vue.runtime.esm.js:4544
init @ vue.runtime.esm.js:4406
(anonymous) @ vue.runtime.esm.js:6567
f @ vue.runtime.esm.js:6521
eo.nodeOps @ vue.runtime.esm.js:7109
e._update @ vue.runtime.esm.js:3765
r @ vue.runtime.esm.js:3875
e.get @ vue.runtime.esm.js:3446
e @ vue.runtime.esm.js:3436
e @ vue.runtime.esm.js:3892
ua.$mount @ vue.runtime.esm.js:8772
e._init @ vue.runtime.esm.js:5701
ua @ vue.runtime.esm.js:5762
(anonymous) @ settings.js:50
(anonymous) @ settings.js:53
(anonymous) @ settings.js:53
Settings.vue:242 me {message: 'Request failed with status code 404', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}
(anonymous) @ Settings.vue:242
Promise.catch (async)
fetchSettings @ Settings.vue:241
created @ Settings.vue:364
En @ vue.runtime.esm.js:3017
Ar @ vue.runtime.esm.js:4031
e._init @ vue.runtime.esm.js:5693
o @ vue.runtime.esm.js:5826
(anonymous) @ vue.runtime.esm.js:4544
init @ vue.runtime.esm.js:4406
(anonymous) @ vue.runtime.esm.js:6567
f @ vue.runtime.esm.js:6521
eo.nodeOps @ vue.runtime.esm.js:7109
e._update @ vue.runtime.esm.js:3765
r @ vue.runtime.esm.js:3875
e.get @ vue.runtime.esm.js:3446
e @ vue.runtime.esm.js:3436
e @ vue.runtime.esm.js:3892
ua.$mount @ vue.runtime.esm.js:8772
e._init @ vue.runtime.esm.js:5701
ua @ vue.runtime.esm.js:5762
(anonymous) @ settings.js:50
(anonymous) @ settings.js:53
(anonymous) @ settings.js:53

@noci2012
Copy link

noci2012 commented Sep 25, 2023

To top it off: access.log (nginx)

::ffff:192.168.20.20 - - [25/Sep/2023:21:57:21 +0200] "GET /apps/shifts/settings HTTP/1.1" 301 169 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:22 +0200] "GET /apps/side_menu/js/config HTTP/1.1" 200 267 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:22 +0200] "GET /avatar/xxxx/64/dark?v=5 HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:22 +0200] "GET /apps/shifts/settings/ HTTP/1.1" 404 4199 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:22 +0200] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:22 +0200] "GET /apps/theming/manifest/settings?v=a954e566 HTTP/1.1" 200 252 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:23 +0200] "GET /apps/theming/favicon/settings?v=a954e566 HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:23 +0200] "GET /apps/theming/icon/settings?v=8 HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:25 +0200] "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1" 200 5352 "https://nc.noci.work/index.php/apps/files/preview-service-worker.js" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:25 +0200] "GET /apps/theming/favicon/settings?v=8 HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
::ffff:192.168.20.20 - - [25/Sep/2023:21:57:52 +0200] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"

Database records:

MariaDB [nextcloud]> select * from oc_appconfig where appid = 'shifts' ;
+--------+---------------------+-----------------------------+
| appid  | configkey           | configvalue                 |
+--------+---------------------+-----------------------------+
| shifts | adminGroup          | ShiftsAdmin                 |
| shifts | calendarName        | ShiftsCalendar              |
| shifts | enabled             | yes                         |
| shifts | installed_version   | 1.9.3                       |
| shifts | organizerEmail      | admin@test.com              |
| shifts | organizerName       | admin                       |
| shifts | shiftChangeSameType | 1                           |
| shifts | shiftWorkerGroup    | Analyst                     |
| shifts | shiftsTimezone      | UTC                         |
| shifts | skillGroups         | [{"id":0,"name":"Level 1"}] |
| shifts | types               |                             |
+--------+---------------------+-----------------------------+
11 rows in set (0.000 sec)

@csoc-kevink
Copy link
Collaborator

Ok, that might be one reason why the app did not work. Version 1.9.0 and above are only compatible with version 25 or high of nextcloud.

The language in the app depends on your language settings in you nc account.

For the base setup you need an admin group (default: ShiftsAdmin). That can be any regular NC group.
If you want to use the calendar app from nextcloud, you also need a dedicated calendar for the shifts app (default: ShiftsCalendar).
The organizer schould be the admin of the nextcloud instance / shifts but is is not required as the organizer will only appear in the calendar invitations.

For the shifts you need a group for all users that should appear in the app (default: Analyst). An for each skill level (at least one) a separate group.
shifts_groups

Example user overview
shifts_user_groups

Example admin settings:
shifts_settings2

@noci2012
Copy link

noci2012 commented Oct 4, 2023

To be clear, the system was version 27.1.1 (Hub 6) BEFORE installing Shifts.
It Originates from a Fresh installed NC 24 and was kept current ever since.
NC Group ShiftsAdmin does exist, as does Analyst, Level 1 and Level 2.
Some users have been assigned to them.
Still there is no data to fetch... I included a Chrome browser console log above.

https://xxxxxxx/settings/admin/shifts --> only shows loading.
In an English languare user-setup a german screen is shown for:
https://xxxxxxx/apps/shifts/timeline
A grid with german language daynames and dates on top and is shown After creating an Analyst & Level 1/ Level 2 groups also names appear in the left column.
There is no option to select/changes/update anything. (black backdrop and white grid, on a dark themed screen with a grey column on the current date).
(adding a ShiftsCalender to the calenders made no difference, and it stays empty as the shifts are uneditable.

Further possible background info: mariadb is used a DB backend. (Although i don;t expect that does matter).

imho the real issue is in

xhr.js:251     GET https://nc.xxxxxxxxxx/apps/shifts/settings/ 404

(from the browser console log above)

I think it matches up with this error from nextcloud:

{"reqId":"b0dfIT6kCqfMZoi3b36d","level":0,"time":"2023-10-04T19:13:50+00:00","remoteAddr":"192.168.xxx.146","user":"xxxxxxx","app":"PHP","method":"G
ET","url":"/settings/admin/shifts","message":"Creation of dynamic property OCA\\FirstRunWizard\\Settings\\Personal::$urlGenerator is deprecated
 at /var/www/nextcloud/apps/firstrunwizard/lib/Settings/Personal.php#40","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML
, like Gecko) Chrome/116.0.0.0 Safari/537.36","version":"27.1.1.0","data":{"app":"PHP"}}

Editing route.php from

                ['name' => 'settings#getSettings', 'url' => '/settings', 'verb' => 'GET'],
                ['name' => 'settings#saveSettings', 'url' => '/settings', 'verb' => 'PUT'],

into

                ['name' => 'settings#getSettings', 'url' => '/settings', 'verb' => 'GET'],
                ['name' => 'settings#getSettings', 'url' => '/settings/', 'verb' => 'GET'],
                ['name' => 'settings#saveSettings', 'url' => '/settings', 'verb' => 'PUT'],
                ['name' => 'settings#saveSettings', 'url' => '/settings/', 'verb' => 'PUT'],

Does make the settings work........ so something goes wrong in route.php

@noci2012
Copy link

noci2012 commented Oct 4, 2023

Saving settings still fails with 405 error though.

https://nc.noci.work/apps/shifts/settings 405

Which means method not allowed... PUT.

The issue most probably is related to nginx not allowing POST/PUT request to items that are read only....
(not put through using proxy_pass) .... The default is location / { ... redirect... /index.php/... }...
most probably causing the issue. (no proxy pass there.

@noci2012
Copy link

noci2012 commented Oct 4, 2023

This might both be an nginx condition.

replacing:

    location / {
        try_files $uri  $uri/ /index.php$request_uri;
    }

into

    error_page 405 =200 @post_static ;
    location @post_static {
         proxy_pass https://$server_name/index.php/$request_uri ;
         proxy_redirect off;
    }
    location / {
        try_files $uri /index.php$request_uri;
    }

changing the adding a / and the 405 error, no adjustment to routes.php needed.

@noci2012
Copy link

noci2012 commented Oct 5, 2023

This is not a complete solution as now the settings can be done, still no options are shown to users in the ShiftsAdmin group, so it still is a read only empty environment. Not sure what is wrong there.

@noci2012
Copy link

noci2012 commented Oct 5, 2023

The above is no solution as it fails URI's without terminating / like ocm-provider / ocs-provider.

@csoc-kevink
Copy link
Collaborator

Have you created some shift-types that can be shown as available shifts in the overview?

@eweinhold
Copy link

eweinhold commented Oct 14, 2023

Similar Issues with NC 27.1.2 and PostgreSQL 13.11
"Einstellungen konnten nicht geladen werden"
no config possible due the settings page is not loading at all.
possible an bug with PostgreSQL as database?

different NC install NC 27.1.2 and mysql 10.5.16
config is possible and settings page is loading and I am able to save the settings.
User, Calendar and Groups are created and filled with at least one user
but apps/shifts/timeline complains
"Daten konnten nicht geladen werden" and no page is loading.

I can't create shifts or anything. :(

Shifts is installed via Appstore and Version 1.9.3 is shown.

@csoc-kevink
Copy link
Collaborator

@eweinhold Does the error still occurs?

@csoc-kevink
Copy link
Collaborator

If the error occurrs again, please open a new issue. I'm closing this one for now.

@noci2012
Copy link

noci2012 commented Mar 25, 2024

@csoc-kevink
The issue still hapens. Installed v. 1.9.7

Is it possible to use non-pretty URLs https://site/index.php/......... for put/post type links?
Those are handled DIFFERENTLY in nginx as they go directly to the http hanadler (which allows posts ... as script may handle data).
locate blocks( matching URLs) those DON't allow POSTS to the URL., except if there is a proxy pass statement in it.

From old nginx release notes:

*) Feature: now Nginx returns the 405 status code for POST method
requesting a static file only if the file exists.

Note: I cannot reopen the issue.

@noci2012
Copy link

noci2012 commented Mar 25, 2024

Example request.

$ curl -X PUT https://SITE/apps/shifts/settings/store/
<html>
<head><title>405 Not Allowed</title></head>
<body>
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx</center>
</body>
</html>
$ curl -X PUT https://SITE/index.php/apps/shifts/settings/store/
<html>
...
...
...
</html>

And with a 404 Error which makes more sense.

@csoc-kevink
Copy link
Collaborator

Hi @noci2012,

i'm not sure what you exactly mean with "non-pretty URLs". The URLs are handled by nextcloud itself and not the shifts app. The only thing I can do is defining the handler for requests. I cannot change the URL.
Maybe the nextcloud documentation on nginx can help you:
https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html

@noci2012
Copy link

noci2012 commented Apr 8, 2024

'pretty" - URL is another name for URL's not exposing some technology... like the use of PHP scripting.
See above a URL https://somesite/apps/shifts/settings/

These urls in nginx go through: (last chance handling)
location / {
try_files $uri $uri/ /index.php$uri ;
}
As there is no proxy_pass / fastcgi_pass in this block it is limited to GET/HEADER and a few queries only.
This block is also used to add a / on failing requests.
So for get queries there is an redirect passing through /index.php, just not for PUT/POST
A log of others liek /ocs ... etc. have some .php script in the URL, the DAV calls all use remote.php

ANY URL that has: .php/ or .php (end of string) is handled with a block like
location ~ .php/? {
.....
fastcgi_pass ..... ;
....
}
Meaning if there is .php in the string PUT/POST are allowed.

so a url in the form of
https://somesite/index.php/apps/shifts/settings ... should active some scripting.
(Due to the pressence of index.php ).

So without a query including index.php shifts will NEVER be activated correctly... causing errors.
At least for nginx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants