nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.37k stars 4.07k forks source link

Document creation return "Error while creating the new file from template" #28996

Closed flifloo closed 1 year ago

flifloo commented 3 years ago

How to use GitHub

Steps to reproduce

  1. Get into a folder with a lot of elements, with no navigator's cache and don't scroll
  2. Create a new document with a name that will not show on the currently visible list

If the view in the list is positioned to have the new documents visible/loaded client-side there is no error.

Expected behaviour

The document is open/the template picker is shown.

Actual behaviour

A notification with Error while creating the new file from template is shown and after scrolling the document is present despite the error.

Server configuration

Operating system: Debian 10 (buster)

Web server: Apache 2.4.38

Database: MariaDB 10.3.27

PHP version: PHP-FPM 7.3.19

Nextcloud version: 22.1.1

Updated from an older Nextcloud/ownCloud or fresh install: Updated

Where did you install Nextcloud from: Downloadable zip from the website

Signing status:

Signing status ``` No errors have been found. ```

List of activated apps:

App list ``` Enabled: - accessibility: 1.7.0 - activity: 2.15.0 - admin_audit: 1.11.0 - cloud_federation_api: 1.4.0 - comments: 1.11.0 - contactsinteraction: 1.2.0 - dav: 1.18.0 - federatedfilesharing: 1.11.0 - federation: 1.11.0 - files: 1.16.0 - files_external: 1.12.1 - files_pdfviewer: 2.3.0 - files_rightclick: 1.1.0 - files_sharing: 1.13.2 - files_trashbin: 1.11.0 - files_versions: 1.14.0 - files_videoplayer: 1.11.0 - impersonate: 1.9.0 - logreader: 2.7.0 - lookup_server_connector: 1.9.0 - nextcloud_announcements: 1.11.0 - notes: 4.1.1 - notifications: 2.10.1 - oauth2: 1.9.0 - onlyoffice: 7.1.2 - password_policy: 1.12.0 - photos: 1.4.0 - polls: 3.2.0 - privacy: 1.6.0 - provisioning_api: 1.11.0 - recommendations: 1.1.0 - serverinfo: 1.12.0 - settings: 1.3.0 - sharebymail: 1.11.0 - spreed: 12.1.2 - support: 1.5.0 - survey_client: 1.10.0 - systemtags: 1.11.0 - text: 3.3.0 - theming: 1.12.0 - twofactor_backupcodes: 1.10.1 - updatenotification: 1.11.0 - user_ldap: 1.11.0 - viewer: 1.6.0 - workflowengine: 2.3.1 Disabled: - circles - dashboard - encryption - firstrunwizard - user_status - weather_status ```

Nextcloud configuration:

Config report ``` { "system": { "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "***REMOVED SENSITIVE VALUE***", "***REMOVED SENSITIVE VALUE***", "***REMOVED SENSITIVE VALUE***" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "22.1.1.2", "overwrite.cli.url": "https:\/\/XXXXXXXXXX", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "instanceid": "***REMOVED SENSITIVE VALUE***", "maintenance": false, "trashbin_retention_obligation": "auto,15", "versions_retention_obligation": "auto,30", "memcache.local": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": "0" }, "memcache.locking": "\\OC\\Memcache\\Redis", "default_language": "fr", "default_locale": "fr_FR", "force_language": "fr", "default_phone_region": "FR", "skeletondirectory": "\/var\/www\/datasnextcloud\/skeleton", "ldapIgnoreNamingRules": false, "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "smtp", "mail_sendmailmode": "smtp", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "465", "mail_smtpauthtype": "LOGIN", "mail_smtpauth": 1, "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "ssl", "loglevel": 2, "allow_local_remote_servers": true } } ```

Are you using external storage, if yes which one: CIFS (This is not where the problem was found or tested)

Are you using encryption: no

Are you using an external user-backend, if yes which one: ActiveDirectory

LDAP configuration (delete this part if not used)

LDAP config ``` +---------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |appid |configkey |configvalue | +---------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |user_ldap|background_sync_interval |43200 | |user_ldap|background_sync_offset |0 | |user_ldap|background_sync_prefix |s01 | |user_ldap|cleanUpJobOffset |0 | |user_ldap|enabled |yes | |user_ldap|installed_version |1.11.0 | |user_ldap|s01_lastChange |1632926102 | |user_ldap|s01has_memberof_filter_support |1 | |user_ldap|s01home_folder_naming_rule | | |user_ldap|s01last_jpegPhoto_lookup |0 | |user_ldap|s01ldap_agent_password |ITkxVnY3M1ZuMDJWYTA4Kg== | |user_ldap|s01ldap_attributes_for_group_search | | |user_ldap|s01ldap_attributes_for_user_search | | |user_ldap|s01ldap_backup_host | | |user_ldap|s01ldap_backup_port | | |user_ldap|s01ldap_base |dc=XXXXXXXXXX | |user_ldap|s01ldap_base_groups |dc=XXXXXXXXXX | |user_ldap|s01ldap_base_users |dc=XXXXXXXXXX | |user_ldap|s01ldap_cache_ttl |600 | |user_ldap|s01ldap_configuration_active |1 | |user_ldap|s01ldap_default_ppolicy_dn | | |user_ldap|s01ldap_display_name |displayname | |user_ldap|s01ldap_dn |XXXXXXXXXX@XXXXXXXXXX | |user_ldap|s01ldap_dynamic_group_member_url | | |user_ldap|s01ldap_email_attr |mail | |user_ldap|s01ldap_experienced_admin |0 | |user_ldap|s01ldap_expert_username_attr |sAMAccountName | |user_ldap|s01ldap_expert_uuid_group_attr | | |user_ldap|s01ldap_expert_uuid_user_attr | | |user_ldap|s01ldap_ext_storage_home_attribute | | |user_ldap|s01ldap_gid_number |gidNumber | |user_ldap|s01ldap_group_display_name |cn | |user_ldap|s01ldap_group_filter |(&(|(objectclass=group))(|(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX)(cn=XXXXXXXXXX))) | |user_ldap|s01ldap_group_filter_mode |0 | |user_ldap|s01ldap_group_member_assoc_attribute|member | |user_ldap|s01ldap_groupfilter_groups |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | |user_ldap|s01ldap_groupfilter_objectclass |group | |user_ldap|s01ldap_host |10.1.12.99 | |user_ldap|s01ldap_login_filter |(&(&(|(objectclass=person))(|(|(memberof=CN=XXXXXXXXXX,CN=Users,DC=XXXXXXXXXX)(primaryGroupID=14467))(|(memberof=CN=XXXXXXXXXX,CN=Users,DC=XXXXXXXXXX)(primaryGroupID=14003))(memberof=CN=XXXXXXXXXX,OU=Annuaire,DC=XXXXXXXXXX)))(|(samaccountname=%uid)(|(mailPrimaryAddress=%uid)(mail=%uid))))| |user_ldap|s01ldap_login_filter_mode |0 | |user_ldap|s01ldap_loginfilter_attributes | | |user_ldap|s01ldap_loginfilter_email |1 | |user_ldap|s01ldap_loginfilter_username |1 | |user_ldap|s01ldap_matching_rule_in_chain_state|unknown | |user_ldap|s01ldap_nested_groups |0 | |user_ldap|s01ldap_override_main_server | | |user_ldap|s01ldap_paging_size |500 | |user_ldap|s01ldap_port |389 | |user_ldap|s01ldap_quota_attr | | |user_ldap|s01ldap_quota_def | | |user_ldap|s01ldap_tls |0 | |user_ldap|s01ldap_turn_off_cert_check |0 | |user_ldap|s01ldap_turn_on_pwd_change |0 | |user_ldap|s01ldap_user_avatar_rule |default | |user_ldap|s01ldap_user_display_name_2 | | |user_ldap|s01ldap_user_filter_mode |0 | |user_ldap|s01ldap_userfilter_groups |XXXXXXXXXX | | | |XXXXXXXXXX | | | |XXXXXXXXXX | |user_ldap|s01ldap_userfilter_objectclass |person | |user_ldap|s01ldap_userlist_filter |(&(|(objectclass=person))(|(|(memberof=CN=XXXXXXXXXX,CN=Users,DC=XXXXXXXXXX)(primaryGroupID=14467))(|(memberof=CN=XXXXXXXXXX,CN=Users,DC=XXXXXXXXXX)(primaryGroupID=14003))(memberof=CN=XXXXXXXXXX,OU=Annuaire,DC=XXXXXXXXXX))) | |user_ldap|s01use_memberof_to_detect_membership|1 | |user_ldap|types |authentication | +---------+------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ```

Client configuration

Browser: Chromium 93.0.4577.82 and Vivaldi 4.2.2406.48

Operating system: Ubuntu 20.04.3 and Arch kernel 5.14.8-arch1-1

Logs

Web server error log

Web server error log ``` No error ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` No error ```

Browser log

Browser log ``` XXXXXXXXXX/:1 Unchecked runtime.lastError: The message port closed before a response was received. jquery-migrate.min.js:2 JQMIGRATE: Migrate is installed, version 3.3.2 App.vue:381 Notifications permissions not yet requested session-heartbeat.js:101 session heartbeat polling started Viewer.vue:263 Please do NOT wait for the DOMContentLoaded before registering your viewer handler handlers @ Viewer.vue:263 Ye @ vue.runtime.esm.js:1863 bn.run @ vue.runtime.esm.js:4584 yn @ vue.runtime.esm.js:4326 (anonymous) @ vue.runtime.esm.js:1989 et @ vue.runtime.esm.js:1915 Promise.then (async) Ze @ vue.runtime.esm.js:1942 it @ vue.runtime.esm.js:1999 (anonymous) @ vue.runtime.esm.js:4418 bn.update @ vue.runtime.esm.js:4560 de.notify @ vue.runtime.esm.js:730 (anonymous) @ vue.runtime.esm.js:882 value @ Viewer.js:69 (anonymous) @ main.js:26 tooltip.js:38 Deprecated call $.tooltip('fixTitle') has been deprecated and should be removed e.tooltip @ tooltip.js:38 checkInput @ merged-index.js?v=6329febc-17:11405 (anonymous) @ merged-index.js?v=6329febc-17:11414 dispatch @ jquery.js:5183 g.handle @ jquery.js:4991 tooltip.js:38 Deprecated call $.tooltip('fixTitle') has been deprecated and should be removed e.tooltip @ tooltip.js:38 checkInput @ merged-index.js?v=6329febc-17:11405 (anonymous) @ merged-index.js?v=6329febc-17:11414 dispatch @ jquery.js:5183 g.handle @ jquery.js:4991 tooltip.js:38 Deprecated call $.tooltip('fixTitle') has been deprecated and should be removed e.tooltip @ tooltip.js:38 checkInput @ merged-index.js?v=6329febc-17:11405 (anonymous) @ merged-index.js?v=6329febc-17:11414 dispatch @ jquery.js:5183 g.handle @ jquery.js:4991 ConsoleLogger.js:54 [ERROR] files: Error while creating the new file from template {app: 'files', uid: 'v-viraphong'}app: "files"uid: "v-viraphong"[[Prototype]]: Objectconstructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__: ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()__proto__: (...)get __proto__: ƒ __proto__()set __proto__: ƒ __proto__() value @ ConsoleLogger.js:54 value @ ConsoleLogger.js:80 (anonymous) @ TemplatePicker.vue:225 l @ runtime.js:63 (anonymous) @ runtime.js:294 (anonymous) @ runtime.js:119 _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 Promise.then (async) _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 Promise.then (async) _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 (anonymous) @ templates.js?v=6329febc-17:250 (anonymous) @ templates.js?v=6329febc-17:250 onSubmit @ TemplatePicker.vue:196 (anonymous) @ TemplatePicker.vue:169 l @ runtime.js:63 (anonymous) @ runtime.js:294 (anonymous) @ runtime.js:119 _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 Promise.then (async) _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 (anonymous) @ templates.js?v=6329febc-17:250 (anonymous) @ templates.js?v=6329febc-17:250 open @ TemplatePicker.vue:154 actionHandler @ templates.js:113 (anonymous) @ merged-index.js?v=6329febc-17:11446 dispatch @ jquery.js:5183 g.handle @ jquery.js:4991 trigger @ jquery.js:8249 (anonymous) @ jquery.js:8327 each @ jquery.js:354 each @ jquery.js:189 trigger @ jquery.js:8326 e.each.e.fn. @ jquery-migrate.min.js:2 (anonymous) @ merged-index.js?v=6329febc-17:11423 dispatch @ jquery.js:5183 g.handle @ jquery.js:4991 TemplatePicker.vue:226 TypeError: Cannot read properties of null (reading 'id') at Object.OCA.Onlyoffice.FileClick [as actionHandler] (main.js?v=6329febc-17:151) at Object.action (merged-index.js?v=6329febc-17:2972) at TemplatePicker.vue:215 at l (runtime.js:63) at Generator._invoke (runtime.js:294) at Generator.next (runtime.js:119) at _ (templates.js?v=6329febc-17:250) at i (templates.js?v=6329febc-17:250) (anonymous) @ TemplatePicker.vue:226 l @ runtime.js:63 (anonymous) @ runtime.js:294 (anonymous) @ runtime.js:119 _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 Promise.then (async) _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 Promise.then (async) _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 (anonymous) @ templates.js?v=6329febc-17:250 (anonymous) @ templates.js?v=6329febc-17:250 onSubmit @ TemplatePicker.vue:196 (anonymous) @ TemplatePicker.vue:169 l @ runtime.js:63 (anonymous) @ runtime.js:294 (anonymous) @ runtime.js:119 _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 Promise.then (async) _ @ templates.js?v=6329febc-17:250 i @ templates.js?v=6329febc-17:250 (anonymous) @ templates.js?v=6329febc-17:250 (anonymous) @ templates.js?v=6329febc-17:250 open @ TemplatePicker.vue:154 actionHandler @ templates.js:113 (anonymous) @ merged-index.js?v=6329febc-17:11446 dispatch @ jquery.js:5183 g.handle @ jquery.js:4991 trigger @ jquery.js:8249 (anonymous) @ jquery.js:8327 each @ jquery.js:354 each @ jquery.js:189 trigger @ jquery.js:8326 e.each.e.fn. @ jquery-migrate.min.js:2 (anonymous) @ merged-index.js?v=6329febc-17:11423 dispatch @ jquery.js:5183 g.handle @ jquery.js:4991 index.js:314 OC.requestToken changed 8k+IYHpZwuf6smX0K9sGODgM8ongkUtt5sWCmOrvUp8=:hh7FDTgys4WQ1lGze75BdHtFpOHW4Xtfo4u336KfZdc= /index.php/core/preview?fileId=311482&c=dab3063be3c4640968ba8fb2c3c7c31a&x=250&y=250&forceIcon=0&a=0:1 GET https://XXXXXXXXXX/index.php/core/preview?fileId=311482&c=dab3063be3c4640968ba8fb2c3c7c31a&x=250&y=250&forceIcon=0&a=0 404 (Not Found) Image (async) lazyLoadPreview @ merged-index.js?v=6329febc-17:6401 _renderRow @ merged-index.js?v=6329febc-17:5974 _nextPage @ merged-index.js?v=6329febc-17:5396 _onScroll @ merged-index.js?v=6329febc-17:5246 Xe @ _executeBound.js:8 (anonymous) @ bind.js:10 (anonymous) @ restArguments.js:16 dispatch @ jquery.js:5183 g.handle @ jquery.js:4991 ```
szaimen commented 3 years ago

I think this will be fixed wirh NC22.2.0. see https://github.com/nextcloud/server/pull/28871

flifloo commented 3 years ago

28871 don't look like the same problem, there is always an extension on new documents like docx

Also, I clone the master and install a development environment and the problem still occur (#28871 is merge in master)

flifloo commented 3 years ago

If you look at the browser logs you clearly see this is a problem with the client-side JS when the document isn't loaded on the page

TemplatePicker.vue:226 TypeError: Cannot read properties of null (reading 'id')
    at Object.OCA.Onlyoffice.FileClick [as actionHandler] (main.js?v=6329febc-17:151)
    at Object.action (merged-index.js?v=6329febc-17:2972)
    at TemplatePicker.vue:215
    at l (runtime.js:63)
    at Generator._invoke (runtime.js:294)
    at Generator.next (runtime.js:119)
    at _ (templates.js?v=6329febc-17:250)
    at i (templates.js?v=6329febc-17:250)
demlak commented 3 years ago

Ok.. fix seems to be adding a real existing folder to config variable: 'templatedirectory' => '/var/www/html/test', (until that, it is also not possible to upload a template in the admin interface) (NOT 'templatedirectory' => '', and NOT 'templatedirectory' => NULL,)

it seems, the problem is write-permission of TemplaetPicker: now, when the config-variable is set, i don't get an error, when i want to create a new file in a folder where i have permissions to do so.. but i still get the same error, when i want to start a new document on a folder where i don't have write permission.

can anyone confirm?


  1. it should be possible to deactivate the template picker (and generation of templates, too)
  2. it should not throw error, but get back to default behaviour if the variable and/or the folder does not exist. especialy on a folder where are no write permissions at all.
  3. The documentation of this "feature" is not good.
szaimen commented 1 year ago

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+