nextcloud / text

📑 Collaborative document editing using Markdown
GNU Affero General Public License v3.0
555 stars 92 forks source link

Jsresourceloader errors #6521

Open l3ochan opened 1 month ago

l3ochan commented 1 month ago

Hi there, I've been getting errors from the text app (NC's notepad) about the jsresourceloader not being able to load text/js/.js. The text app works fine. But its throwing a lot of log entries (like handreads everyday, see screenshot)

Here are my system info: OS: Ubuntu server 24.04.1 LTS NC version: 29.0.7.1 Web server: Apache db engine: Mariadb 10.11.8 php: 8.3 User backend is on the db

Here's one of the handreads of the same log entries I'm getting

{
  "reqId": "Zv5ICUoyFaaJcSHz_ee57QAAAAU",
  "level": 3,
  "time": "2024-10-03T07:30:17+00:00",
  "remoteAddr": "***REDACTED***",
  "user": "admin",
  "app": "jsresourceloader",
  "method": "GET",
  "url": "/apps/files/",
  "message": "Could not find resource text/js/.js to load",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
  "version": "29.0.7.1",
  "data": {
    "app": "jsresourceloader"
  },
  "id": "66fe481ea5d44"
}

No issues with the signing status of my instance

Here's my instance's config:

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED DOMAINS***"        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "forwarded_for_headers": [
            "HTTP_CF_CONNECTING_IP"
        ],
        "overwriteprotocol": "https",
        "enabledPreviewProviders": [
            "OC\\Preview\\BMP",
            "OC\\Preview\\GIF",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\MP3",
            "OC\\Preview\\PNG",
            "OC\\Preview\\TXT",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\OpenDocument",
            "OC\\Preview\\Krita",
            "OC\\Preview\\WebP",
            "OC\\Preview\\Movie"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "29.0.7.1",
        "overwrite.cli.url": "http:\/\/***REMOVED URL***",
        "htaccess.RewriteBase": "\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "filelocking.enabled": true,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": "6379",
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "default_phone_region": "FR",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "app_install_overwrite": [
            "officeonline",
            "whiteboard",
            "files_antivirus",
            "googledocsredirect",
            "apporder",
            "integration_moodle",
            "group_default_quota",
            "keeporsweep",
            "files_mindmap",
            "printer",
            "integration_whiteboard",
            "video_converter",
            "carnet",
            "caniupdate",
            "impersonate",
            "ocsms",
            "hancomoffice",
            "wopi",
            "admin_notifications",
            "pdfdraw",
            "cfg_share_links",
            "shifts",
            "richdocumentscode",
            "files_downloadactivity",
            "camerarawpreviews",
            "hibp",
            "metadata",
            "externalportal",
            "extract",
            "files_downloadlimit",
            "circles",
            "integration_ews",
            "fulltextsearch",
            "guests",
            "secrets",
            "twofactor_email",
            "user_cas",
            "workspace",
            "mailnotifier"
        ],
        "theme": "",
        "loglevel": 2,
        "maintenance_window_start": "\u201c19\u201d",
        "updater.release.channel": "stable",
        "mail_smtpsecure": "ssl",
        "defaultapp": "",
        "maintenance": false,
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [
            "everyone"
        ],
        "twofactor_enforced_excluded_groups": []
    }
}

Image

Thanks.

juliusknorr commented 1 month ago

I cannot reproduce that. Unfortunately the log message doesn't have a trace to tell where it is being called from.

Can you maybe apply the following patch to your server, get a fresh log line and share that here? That would give us a clear trace where that is being called.

diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php
index aad999f939a..53c95d49407 100644
--- a/lib/private/Template/JSResourceLocator.php
+++ b/lib/private/Template/JSResourceLocator.php
@@ -87,6 +87,7 @@ class JSResourceLocator extends ResourceLocator {
                $this->logger->error('Could not find resource {resource} to load', [
                        'resource' => $script . '.js',
                        'app' => 'jsresourceloader',
+                       'exception' => new \Exception(),
                ]);
        }
l3ochan commented 1 month ago

Hi ! I made the change you requested. It doesn't look like there is much more information though. Here is the log entry anyway

{
  "reqId": "ZxE5vzyQRcfnxBN2ZHib-gAAABE",
  "level": 3,
  "time": "2024-10-17T16:22:24+00:00",
  "remoteAddr": "***REDACTED***",
  "user": "Leo",
  "app": "jsresourceloader",
  "method": "GET",
  "url": "/apps/files/",
  "message": "Could not find resource text/js/.js to load",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
  "version": "30.0.1.2",
  "exception": {
    "Exception": "Exception",
    "Message": "",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud.placeholder.tld/lib/private/Template/ResourceLocator.php",
        "line": 51,
        "function": "doFind",
        "class": "OC\\Template\\JSResourceLocator",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud.placeholder.tld/lib/private/TemplateLayout.php",
        "line": 380,
        "function": "find",
        "class": "OC\\Template\\ResourceLocator",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud.placeholder.tld/lib/private/TemplateLayout.php",
        "line": 216,
        "function": "findJavascriptFiles",
        "class": "OC\\TemplateLayout",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud.placeholder.tld/lib/private/legacy/OC_Template.php",
        "line": 119,
        "function": "__construct",
        "class": "OC\\TemplateLayout",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud.placeholder.tld/lib/public/AppFramework/Http/TemplateResponse.php",
        "line": 189,
        "function": "fetchPage",
        "class": "OC_Template",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud.placeholder.tld/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 159,
        "function": "render",
        "class": "OCP\\AppFramework\\Http\\TemplateResponse",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud.placeholder.tld/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud.placeholder.tld/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud.placeholder.tld/lib/base.php",
        "line": 1001,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud.placeholder.tld/index.php",
        "line": 24,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud.placeholder.tld/lib/private/Template/JSResourceLocator.php",
    "Line": 90,
    "message": "Could not find resource {resource} to load",
    "exception": [],
    "CustomMessage": "Could not find resource text/js/.js to load"
  },
  "id": "671139e651564"