bookmarks icon indicating copy to clipboard operation
bookmarks copied to clipboard

API throws 500 error when creating bookmark

Open krmax44 opened this issue 3 months ago • 3 comments

Describe the bug

The API responds with a 500 server error.

To Reproduce

POST /index.php/apps/bookmarks/public/rest/v2/bookmark?url=…
Authorization: Basic user:pass

Expected behavior A clear and concise description of what you expected to happen.

Screenshots

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Safari
  • Version: MacOS 13

Server (please complete the following information):

  • OS: Docker, Arch
  • HTTP server: Caddy
  • Database: MySQL
  • PHP version: 8.3
  • Nextcloud version: 28
  • Bookmarks app version: 13.1.3
  • Activated Nextcloud Apps:
  • Nextcloud configuration:
  • Nextcloud external user backend: none

Additional context Add any other context about the problem here.

Web server error log

Insert your webserver log here

Nextcloud log (nextcloud/data/nextcloud.log)

message":"OC\\Authentication\\Token\\Manager::getToken(): Argument #1 ($tokenId) must be of type string, null given, called in /var/www/html/lib/private/User/Session.php on line 794 in file '/var/www/html/lib/private/Authentication/Token/Manager.php' line 133","userAgent":"BackgroundShortcutRunner/2510.5.1 CFNetwork/1494.0.7 Darwin/23.4.0","version":"28.0.2.5","exception":{"Exception":"Exception","Message":"OC\\Authentication\\Token\\Manager::getToken(): Argument #1 ($tokenId) must be of type string, null given, called in /var/www/html/lib/private/User/Session.php on line 794 in file '/var/www/html/lib/private/Authentication/Token/Manager.php' line 133","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Bookmarks\\Controller\\BookmarkController"],"newBookmark"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Bookmarks\\Controller\\BookmarkController","newBookmark",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["bookmarks.bookmark.new_bookmark"]]},{"file":"/var/www/html/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/bookmarks/public/rest/v2/bookmark"]},{"file":"/var/www/html/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"TypeError","Message":"OC\\Authentication\\Token\\Manager::getToken(): Argument #1 ($tokenId) must be of type string, null given, called in /var/www/html/lib/private/User/Session.php on line 794","Code":0,"Trace":[{"file":"/var/www/html/lib/private/User/Session.php","line":794,"function":"getToken","class":"OC\\Authentication\\Token\\Manager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/User/Session.php","line":353,"function":"validateToken","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/bookmarks/lib/Service/Authorizer.php","line":85,"function":"login","class":"OC\\User\\Session","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/bookmarks/lib/Controller/BookmarkController.php","line":417,"function":"setCredentials","class":"OCA\\Bookmarks\\Service\\Authorizer","type":"->","args":[["OC\\AppFramework\\Http\\Request"]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"newBookmark","class":"OCA\\Bookmarks\\Controller\\BookmarkController","type":"->","args":["https://github.com/nextcloud/bookmarks/issues?q=api error","*** sensitive parameters replaced ***","*** sensitive parameters replaced ***","*** sensitive parameters replaced ***",[],"*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Bookmarks\\Controller\\BookmarkController"],"newBookmark"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Bookmarks\\Controller\\BookmarkController"],"newBookmark"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Bookmarks\\Controller\\BookmarkController","newBookmark",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["bookmarks.bookmark.new_bookmark"]]},{"file":"/var/www/html/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/bookmarks/public/rest/v2/bookmark"]},{"file":"/var/www/html/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Authentication/Token/Manager.php","Line":133},"message":"OC\\Authentication\\Token\\Manager::getToken(): Argument #1 ($tokenId) must be of type string, null given, called in /var/www/html/lib/private/User/Session.php on line 794 in file '/var/www/html/lib/private/Authentication/Token/Manager.php' line 133","exception":{},"CustomMessage":"OC\\Authentication\\Token\\Manager::getToken(): Argument #1 ($tokenId) must be of type string, null given, called in /var/www/html/lib/private/User/Session.php on line 794 in file '/var/www/html/lib/private/Authentication/Token/Manager.php' line 133"}}

Browser log

krmax44 avatar Mar 21 '24 11:03 krmax44

Hello :wave:

Thank you for taking the time to open this issue with the bookmarks app. I know it's frustrating when software causes problems. You have made the right choice to come here and open an issue to make sure your problem gets looked at and if possible solved. I'm Marcel and have been maintaining this software the last few years. I currently work for Nextcloud but maintain this app in my free time, because it is not an official Nextcloud product. My day job at Nextcloud is pretty awesome but sadly leaves me with less time for side projects like this one than I used to have. I still try to answer all issues and if possible fix all bugs here, but it sometimes takes a while until I get to it. Until then, please be patient. Note also that GitHub is a place where people meet to make software better together. Nobody here is under any obligation to help you, solve your problems or deliver on any expectations or demands you may have, but if enough people come together we can collaborate to make this software better. For everyone. Thus, if you can, you could also look at other issues to see whether you can help other people with your knowledge and experience. If you have coding experience it would also be awesome if you could step up to dive into the code and try to fix the odd bug yourself. Everyone will be thankful for extra helping hands! One last word: If you feel, at any point, like you need to vent, this is not the place for it; you can go to the forum, to twitter or somewhere else. But this is a technical issue tracker, so please make sure to focus on the tech and keep your opinions to yourself. (Also see our Code of Conduct. Really.)

I look forward to working with you on this issue Cheers :blue_heart:

github-actions[bot] avatar Mar 21 '24 11:03 github-actions[bot]

Are you base64 encoding the credentials?

marcelklehr avatar Mar 22 '24 09:03 marcelklehr

No, it works fine with that. But this shouldn't cause a server error.

krmax44 avatar Mar 22 '24 15:03 krmax44