linuxserver / docker-grocy

A container for grocy - the ERP application for your kitchen https://grocy.info
GNU General Public License v3.0
340 stars 43 forks source link

iCal Calendar not working -> GET /calendar/ical returns error 500 #48

Closed superbreadi closed 3 years ago

superbreadi commented 3 years ago

Expected Behavior

Get ics calendar file in Grocy 3.1.0 when open ical link Like in this example: https://en.demo.grocy.info/api/calendar/ical?secret=PziE4Yu17bq3vTgUfSZ8Qw4U3q0EalmX2Z4NW3kApqMfHkOQUL

Current Behavior

Since Update to grocy 3.1.0 : Error 500 Message

Steps to Reproduce

  1. Request iCal Link in Browser https://grocyhost/api/calendar/ical?secret=###SECRET###
  2. See Error 500 + JSON Error

Environment

OS: Debian 11 CPU architecture: x86_64 How docker service was installed: offical docker repo

Command used to create docker container (compose)

dockercompose:

 grocy:
    image: linuxserver/grocy
    container_name: grocy
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - CULTURE=de
    networks:
       bridge:
    volumes:
      - grocy_config:/config
    ports:
      - 9283:80
    restart: unless-stopped

Docker logs

Error: Internal Server Error

{
  "error_message": "Argument 1 passed to Eluceo\\iCal\\Domain\\ValueObject\\PointInTime::__construct() must implement interface DateTimeInterface or be null, bool given, called in /app/grocy/controllers/CalendarApiController.php on line 33",
  "error_details": {
    "stack_trace": "#0 /app/grocy/controllers/CalendarApiController.php(33): Eluceo\\iCal\\Domain\\ValueObject\\PointInTime->__construct()\n#1 /app/grocy/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(43): Grocy\\Controllers\\CalendarApiController->Ical()\n#2 /app/grocy/vendor/slim/slim/Slim/Routing/Route.php(384): Slim\\Handlers\\Strategies\\RequestResponse->__invoke()\n#3 /app/grocy/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\\Routing\\Route->handle()\n#4 /app/grocy/middleware/JsonMiddleware.php(13): Slim\\MiddlewareDispatcher->handle()\n#5 /app/grocy/vendor/slim/slim/Slim/MiddlewareDispatcher.php(209): Grocy\\Middleware\\JsonMiddleware->__invoke()\n#6 /app/grocy/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): class@anonymous->handle()\n#7 /app/grocy/vendor/slim/slim/Slim/Routing/Route.php(341): Slim\\MiddlewareDispatcher->handle()\n#8 /app/grocy/vendor/slim/slim/Slim/Routing/RouteRunner.php(84): Slim\\Routing\\Route->run()\n#9 /app/grocy/middleware/LocaleMiddleware.php(16): Slim\\Routing\\RouteRunner->handle()\n#10 /app/grocy/vendor/slim/slim/Slim/MiddlewareDispatcher.php(313): Grocy\\Middleware\\LocaleMiddleware->__invoke()\n#11 /app/grocy/middleware/AuthMiddleware.php(76): class@anonymous->handle()\n#12 /app/grocy/vendor/slim/slim/Slim/MiddlewareDispatcher.php(313): Grocy\\Middleware\\AuthMiddleware->__invoke()\n#13 /app/grocy/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(59): class@anonymous->handle()\n#14 /app/grocy/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\\Middleware\\RoutingMiddleware->process()\n#15 /app/grocy/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(107): class@anonymous->handle()\n#16 /app/grocy/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\\Middleware\\ErrorMiddleware->process()\n#17 /app/grocy/middleware/CorsMiddleware.php(30): class@anonymous->handle()\n#18 /app/grocy/vendor/slim/slim/Slim/MiddlewareDispatcher.php(313): Grocy\\Middleware\\CorsMiddleware->__invoke()\n#19 /app/grocy/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): class@anonymous->handle()\n#20 /app/grocy/vendor/slim/slim/Slim/App.php(215): Slim\\MiddlewareDispatcher->handle()\n#21 /app/grocy/vendor/slim/slim/Slim/App.php(199): Slim\\App->handle()\n#22 /app/grocy/app.php(106): Slim\\App->run()\n#23 /app/grocy/public/index.php(45): require_once('/app/grocy/app....')\n#24 {main}",
    "file": "/app/grocy/vendor/eluceo/ical/src/Domain/ValueObject/PointInTime.php",
    "line": 26
  }
}
github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

homerr commented 3 years ago

Sorry I can't get this one to reproduce, have you had grocy set up for a while? I've just spun an instance up for testing and it works OK on http or https. How are you accessing grocy?

superbreadi commented 3 years ago

Hi, yes I use the linuxserver/grocy container since 03/2020. Normally I access over https:443 / haproxy / http:9283, but I have the same issue over direct access http:9283 since update to 3.1

superbreadi commented 3 years ago

Okay I just checked what happens when I delete the grocy.db file inside the container and start "fresh" ... login as admin and iCal just working fine. Maybe Database file is corrupted? But everything else worked just fine until the update.

superbreadi commented 3 years ago

Ok got to a fix, I deleted all chores, suddenly it worked... but only if I delete all. I checked special characters first.. grafik

superbreadi commented 3 years ago

Okay you can recreate this bug in grocy when you create a chore with an interval and "Track date only" option set