nextcloud / nextcloud/sharepoint

Setup successful but user gets "Failed to create the document session"

Open
#205 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
PHP
Stars
33
Forks
15
PR merge metrics
No merged PRs in 30d

Description

I've successfully set up a sharepoint instance, but when the user goes to that folder, they get a popup after a few seconds which says Failed to create the document session.

At the same time, there is an error in the logs: General error: 1364 Field 'last_saved_version_time' doesn't have a default value

The full error message is this:

{
  "reqId": "pJl7DVtBPqyaN5sP0E9q",
  "level": 3,
  "time": "2024-05-13T12:07:08+00:00",
  "remoteAddr": "192.168.3.44",
  "user": "jurgenhaas",
  "app": "text",
  "method": "PUT",
  "url": "/index.php/apps/text/session/1672330/create",
  "message": "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'last_saved_version_time' doesn't have a default value",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
  "version": "29.0.0.19",
  "exception": {
    "Exception": "OC\\DB\\Exceptions\\DbalException",
    "Message": "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'last_saved_version_time' doesn't have a default value",
    "Code": 1364,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",
        "line": 328,
        "function": "wrap",
        "class": "OC\\DB\\Exceptions\\DbalException",
        "type": "::"
      },
      {
        "file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
        "line": 137,
        "function": "executeStatement",
        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/text/lib/Service/DocumentService.php",
        "line": 162,
        "function": "insert",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/text/lib/Service/ApiService.php",
        "line": 125,
        "function": "createDocument",
        "class": "OCA\\Text\\Service\\DocumentService",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/apps/text/lib/Controller/SessionController.php",
        "line": 62,
        "function": "create",
        "class": "OCA\\Text\\Service\\ApiService",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 232,
        "function": "create",
        "class": "OCA\\Text\\Controller\\SessionController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 138,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 338,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1050,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/html/index.php",
        "line": 49,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/html/lib/private/DB/Exceptions/DbalException.php",
    "Line": 71,
    "Previous": {
      "Exception": "Doctrine\\DBAL\\Exception\\NotNullConstraintViolationException",
      "Message": "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'last_saved_version_time' doesn't have a default value",
      "Code": 1364,
      "Trace": [
        {
          "file": "/var/www/html/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1943,
          "function": "convert",
          "class": "Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter",
          "type": "->"
        },
        {
          "file": "/var/www/html/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1885,
          "function": "handleDriverException",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/html/3rdparty/doctrine/dbal/src/Connection.php",
          "line": 1213,
          "function": "convertExceptionDuringQuery",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/html/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php",
          "line": 292,
          "function": "executeStatement",
          "class": "Doctrine\\DBAL\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/private/DB/Connection.php",
          "line": 360,
          "function": "executeStatement",
          "class": "Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection",
          "type": "->"
        },
        {
          "file": "/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
          "line": 393,
          "function": "executeStatement",
          "class": "OC\\DB\\Connection",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",
          "line": 280,
          "function": "execute",
          "class": "Doctrine\\DBAL\\Query\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",
          "line": 326,
          "function": "execute",
          "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
          "line": 137,
          "function": "executeStatement",
          "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
          "type": "->"
        },
        {
          "file": "/var/www/html/apps/text/lib/Service/DocumentService.php",
          "line": 162,
          "function": "insert",
          "class": "OCP\\AppFramework\\Db\\QBMapper",
          "type": "->"
        },
        {
          "file": "/var/www/html/apps/text/lib/Service/ApiService.php",
          "line": 125,
          "function": "createDocument",
          "class": "OCA\\Text\\Service\\DocumentService",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/apps/text/lib/Controller/SessionController.php",
          "line": 62,
          "function": "create",
          "class": "OCA\\Text\\Service\\ApiService",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 232,
          "function": "create",
          "class": "OCA\\Text\\Controller\\SessionController",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 138,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 184,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 338,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/html/lib/base.php",
          "line": 1050,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/html/index.php",
          "line": 49,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/html/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php",
      "Line": 114,
      "Previous": {
        "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
        "Message": "SQLSTATE[HY000]: General error: 1364 Field 'last_saved_version_time' doesn't have a default value",
        "Code": 1364,
        "Trace": [
          {
            "file": "/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
            "line": 132,
            "function": "new",
            "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
            "type": "::"
          },
          {
            "file": "/var/www/html/3rdparty/doctrine/dbal/src/Connection.php",
            "line": 1207,
            "function": "execute",
            "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
            "type": "->"
          },
          {
            "file": "/var/www/html/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php",
            "line": 292,
            "function": "executeStatement",
            "class": "Doctrine\\DBAL\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/html/lib/private/DB/Connection.php",
            "line": 360,
            "function": "executeStatement",
            "class": "Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection",
            "type": "->"
          },
          {
            "file": "/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
            "line": 393,
            "function": "executeStatement",
            "class": "OC\\DB\\Connection",
            "type": "->"
          },
          {
            "file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",
            "line": 280,
            "function": "execute",
            "class": "Doctrine\\DBAL\\Query\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",
            "line": 326,
            "function": "execute",
            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
            "line": 137,
            "function": "executeStatement",
            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
            "type": "->"
          },
          {
            "file": "/var/www/html/apps/text/lib/Service/DocumentService.php",
            "line": 162,
            "function": "insert",
            "class": "OCP\\AppFramework\\Db\\QBMapper",
            "type": "->"
          },
          {
            "file": "/var/www/html/apps/text/lib/Service/ApiService.php",
            "line": 125,
            "function": "createDocument",
            "class": "OCA\\Text\\Service\\DocumentService",
            "type": "->",
            "args": [
              "*** sensitive parameters replaced ***"
            ]
          },
          {
            "file": "/var/www/html/apps/text/lib/Controller/SessionController.php",
            "line": 62,
            "function": "create",
            "class": "OCA\\Text\\Service\\ApiService",
            "type": "->",
            "args": [
              "*** sensitive parameters replaced ***"
            ]
          },
          {
            "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 232,
            "function": "create",
            "class": "OCA\\Text\\Controller\\SessionController",
            "type": "->",
            "args": [
              "*** sensitive parameters replaced ***"
            ]
          },
          {
            "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 138,
            "function": "executeController",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/html/lib/private/AppFramework/App.php",
            "line": 184,
            "function": "dispatch",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/html/lib/private/Route/Router.php",
            "line": 338,
            "function": "main",
            "class": "OC\\AppFramework\\App",
            "type": "::"
          },
          {
            "file": "/var/www/html/lib/base.php",
            "line": 1050,
            "function": "match",
            "class": "OC\\Route\\Router",
            "type": "->"
          },
          {
            "file": "/var/www/html/index.php",
            "line": 49,
            "function": "handleRequest",
            "class": "OC",
            "type": "::"
          }
        ],
        "File": "/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",
        "Line": 28,
        "Previous": {
          "Exception": "PDOException",
          "Message": "SQLSTATE[HY000]: General error: 1364 Field 'last_saved_version_time' doesn't have a default value",
          "Code": "HY000",
          "Trace": [
            {
              "file": "/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
              "line": 130,
              "function": "execute",
              "class": "PDOStatement",
              "type": "->"
            },
            {
              "file": "/var/www/html/3rdparty/doctrine/dbal/src/Connection.php",
              "line": 1207,
              "function": "execute",
              "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
              "type": "->"
            },
            {
              "file": "/var/www/html/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php",
              "line": 292,
              "function": "executeStatement",
              "class": "Doctrine\\DBAL\\Connection",
              "type": "->"
            },
            {
              "file": "/var/www/html/lib/private/DB/Connection.php",
              "line": 360,
              "function": "executeStatement",
              "class": "Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection",
              "type": "->"
            },
            {
              "file": "/var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php",
              "line": 393,
              "function": "executeStatement",
              "class": "OC\\DB\\Connection",
              "type": "->"
            },
            {
              "file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",
              "line": 280,
              "function": "execute",
              "class": "Doctrine\\DBAL\\Query\\QueryBuilder",
              "type": "->"
            },
            {
              "file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",
              "line": 326,
              "function": "execute",
              "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
              "type": "->"
            },
            {
              "file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
              "line": 137,
              "function": "executeStatement",
              "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
              "type": "->"
            },
            {
              "file": "/var/www/html/apps/text/lib/Service/DocumentService.php",
              "line": 162,
              "function": "insert",
              "class": "OCP\\AppFramework\\Db\\QBMapper",
              "type": "->"
            },
            {
              "file": "/var/www/html/apps/text/lib/Service/ApiService.php",
              "line": 125,
              "function": "createDocument",
              "class": "OCA\\Text\\Service\\DocumentService",
              "type": "->",
              "args": [
                "*** sensitive parameters replaced ***"
              ]
            },
            {
              "file": "/var/www/html/apps/text/lib/Controller/SessionController.php",
              "line": 62,
              "function": "create",
              "class": "OCA\\Text\\Service\\ApiService",
              "type": "->",
              "args": [
                "*** sensitive parameters replaced ***"
              ]
            },
            {
              "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
              "line": 232,
              "function": "create",
              "class": "OCA\\Text\\Controller\\SessionController",
              "type": "->",
              "args": [
                "*** sensitive parameters replaced ***"
              ]
            },
            {
              "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
              "line": 138,
              "function": "executeController",
              "class": "OC\\AppFramework\\Http\\Dispatcher",
              "type": "->"
            },
            {
              "file": "/var/www/html/lib/private/AppFramework/App.php",
              "line": 184,
              "function": "dispatch",
              "class": "OC\\AppFramework\\Http\\Dispatcher",
              "type": "->"
            },
            {
              "file": "/var/www/html/lib/private/Route/Router.php",
              "line": 338,
              "function": "main",
              "class": "OC\\AppFramework\\App",
              "type": "::"
            },
            {
              "file": "/var/www/html/lib/base.php",
              "line": 1050,
              "function": "match",
              "class": "OC\\Route\\Router",
              "type": "->"
            },
            {
              "file": "/var/www/html/index.php",
              "line": 49,
              "function": "handleRequest",
              "class": "OC",
              "type": "::"
            }
          ],
          "File": "/var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
          "Line": 130
        }
      }
    },
    "message": "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'last_saved_version_time' doesn't have a default value",
    "exception": {},
    "CustomMessage": "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1364 Field 'last_saved_version_time' doesn't have a default value"
  }
}

All components (NC, app, PHP, etc.) are at the latest versions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at apps/text/lib/Service/DocumentService.php line 162, where the session creation trace inserts the document, then follow ApiService.php line 125 and SessionController.php line 62. Reproduce the PUT session-creation request and inspect the database fields involved. Done means creating a document session no longer fails with the last_saved_version_time error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.