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

[Bug]: Placing photos on custom map produces an error #1087

Open
6 of 9 tasks
alaskanpuffin opened this issue Jul 1, 2023 · 4 comments
Open
6 of 9 tasks

[Bug]: Placing photos on custom map produces an error #1087

alaskanpuffin opened this issue Jul 1, 2023 · 4 comments

Comments

@alaskanpuffin
Copy link
Contributor

⚠️ This issue respects the following points: ⚠️

Bug description

Placing a photo using the context menu on a custom map (non-default) results in a 500 error on the post request.

Steps to reproduce

  1. Create a new map
  2. Right click and click place photo from context menu
  3. Place a photo

Expected behavior

The photo should be placed on the custom map, as it works on the default map.

Installation method

Official Docker image

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install of the server?

Fresh Nextcloud Server install

Is this bug present after an update or on a fresh install of the app?

Fresh Nextcloud Maps install (never installed before)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost:8080"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "26.0.3.2",
        "overwrite.cli.url": "http:\/\/localhost:8080",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true
    }
}

List of activated Apps

Enabled:
  - activity: 2.18.0
  - circles: 26.0.0
  - cloud_federation_api: 1.9.0
  - comments: 1.16.0
  - contacts: 5.3.2
  - contactsinteraction: 1.7.0
  - dashboard: 7.6.0
  - dav: 1.25.0
  - federatedfilesharing: 1.16.0
  - federation: 1.16.0
  - files: 1.21.1
  - files_pdfviewer: 2.7.0
  - files_rightclick: 1.5.0
  - files_sharing: 1.18.0
  - files_trashbin: 1.16.0
  - files_versions: 1.19.1
  - firstrunwizard: 2.15.0
  - logreader: 2.11.0
  - lookup_server_connector: 1.14.0
  - maps: 1.1.0
  - nextcloud_announcements: 1.15.0
  - notifications: 2.14.0
  - oauth2: 1.14.0
  - password_policy: 1.16.0
  - photos: 2.2.0
  - privacy: 1.10.0
  - provisioning_api: 1.16.0
  - recommendations: 1.5.0
  - related_resources: 1.1.0-alpha1
  - serverinfo: 1.16.0
  - settings: 1.8.0
  - sharebymail: 1.16.0
  - support: 1.9.0
  - survey_client: 1.14.0
  - systemtags: 1.16.0
  - text: 3.7.2
  - theming: 2.1.1
  - twofactor_backupcodes: 1.15.0
  - updatenotification: 1.16.0
  - user_status: 1.6.0
  - viewer: 1.10.0
  - weather_status: 1.6.0
  - workflowengine: 2.8.0
Disabled:
  - admin_audit: 1.16.0
  - bruteforcesettings: 2.6.0
  - encryption: 2.14.0
  - files_external: 1.18.0
  - suspicious_login: 4.4.0
  - twofactor_totp: 8.0.0
  - user_ldap: 1.16.0

Nextcloud Signing status

No response

Nextcloud Logs

{
  "reqId": "2bIJ1UludSI2oPehc0jz",
  "level": 3,
  "time": "2023-07-01T03:00:58+00:00",
  "remoteAddr": "172.18.0.1",
  "user": "*******",
  "app": "index",
  "method": "POST",
  "url": "/apps/maps/photos",
  "message": "Did expect one result but found none when executing: query \"SELECT * FROM `*PREFIX*maps_photos` WHERE (`user_id` = :dcValue1) AND (`file_id` = :dcValue2)\"; ",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0",
  "version": "26.0.3.2",
  "exception": {
    "Exception": "OCP\\AppFramework\\Db\\DoesNotExistException",
    "Message": "Did expect one result but found none when executing: query \"SELECT * FROM `*PREFIX*maps_photos` WHERE (`user_id` = :dcValue1) AND (`file_id` = :dcValue2)\"; ",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
        "line": 362,
        "function": "findOneQuery",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->",
        "args": [
          [
            "OC\\DB\\QueryBuilder\\QueryBuilder"
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/maps/lib/DB/GeophotoMapper.php",
        "line": 65,
        "function": "findEntity",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->",
        "args": [
          [
            "OC\\DB\\QueryBuilder\\QueryBuilder"
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/maps/lib/Service/PhotofilesService.php",
        "line": 294,
        "function": "findByFileIdUserId",
        "class": "OCA\\Maps\\DB\\GeophotoMapper",
        "type": "->",
        "args": [
          350,
          "user"
        ]
      },
      {
        "file": "/var/www/html/apps/maps/lib/Service/PhotofilesService.php",
        "line": 248,
        "function": "setFilesCoords",
        "class": "OCA\\Maps\\Service\\PhotofilesService",
        "type": "->",
        "args": [
          "user",
          [
            "/Maps/Test/Frog.jpg"
          ],
          [
            30.44408599180477
          ],
          [
            -87.24440574645998
          ]
        ]
      },
      {
        "file": "/var/www/html/apps/maps/lib/Controller/PhotosController.php",
        "line": 147,
        "function": "setPhotosFilesCoords",
        "class": "OCA\\Maps\\Service\\PhotofilesService",
        "type": "->",
        "args": [
          "user",
          [
            "/Maps/Test/Frog.jpg"
          ],
          [
            30.44408599180477
          ],
          [
            -87.24440574645998
          ],
          false
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "placePhotos",
        "class": "OCA\\Maps\\Controller\\PhotosController",
        "type": "->",
        "args": [
          [
            "/Maps/Test/Frog.jpg"
          ],
          [
            30.44408599180477
          ],
          [
            -87.24440574645998
          ],
          false,
          343,
          false
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Maps\\Controller\\PhotosController"
          ],
          "placePhotos"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 183,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          [
            "OCA\\Maps\\Controller\\PhotosController"
          ],
          "placePhotos"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Maps\\Controller\\PhotosController",
          "placePhotos",
          [
            "OC\\AppFramework\\DependencyInjection\\DIContainer"
          ],
          [
            "maps.photos.placePhotos"
          ]
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1060,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/maps/photos"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
    "Line": 284,
    "CustomMessage": "--"
  }
}

Browser Console

No response

Additional info

No response

@tacruc
Copy link
Collaborator

tacruc commented Jul 1, 2023

Interessring, thanks for reporting.

@alaskanpuffin
Copy link
Contributor Author

alaskanpuffin commented Jul 1, 2023

It looks like it was caused by the photos not being scanned by the background job. How does the background job work? Is it run every time cron.php is called, or is it only after a certain time interval?

It could be helpful to add an indicator for the status of the file scan job, and for this specific error add an error message stating that the file has not been imported yet. The existing messages are a bit unclear, just stating it could take a while.

@tacruc
Copy link
Collaborator

tacruc commented Jul 1, 2023

The metadata extraction works in two steps.
For each photo an extraction job has to be scheduled.
This is either done by OCC maps:scan-photos or via the filesystem hooks when a photo is uploaded or changed.

In principle OCC should schedule the extraction for all photos which are on nextcloud before maps was installed and the file hooks the monitor the changes.

Then during the Cron job the metadata extraction jobs are processed. One after another for. As this is the same list as all other jobs scheduled by Nextcloud it is hard to estimate how long it will take until all scheduled jobs are processed.

Anyhow on page load the maps app should show a notification, when there are not processed Backgroundjobs I the schedule.

@tacruc
Copy link
Collaborator

tacruc commented Jul 1, 2023

I hope that this process can be migrated to a process where the server handels the metadata. And we get the photos via WebDAV requests.

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

No branches or pull requests

2 participants