mealie-recipes / mealie

Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor
https://docs.mealie.io
GNU Affero General Public License v3.0
6.81k stars 702 forks source link

[BUG] - Nextcloud Migration fails #2484

Closed sabatmonk closed 1 year ago

sabatmonk commented 1 year ago

First Check

What is the issue you are experiencing?

whenever i`m trying to import recipes from my nextcloud cookbook, the task gets added, but is permanently stuck at in-progress. If i go check the API logs, i see the output provided in the log section. Even when testing with a single recipe, with all non-listed file (like the smaller thumb image) removed, it still fails.

Steps to Reproduce

1) download recipes from nextcloud 2) upload the nextcloud.zip to the importer and click import

Please provide relevent logs

Traceback (most recent call last): 2023-08-07T12:42:49.836794429Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 436, in run_asgi 2023-08-07T12:42:49.836819299Z result = await app( # type: ignore[func-returns-value] 2023-08-07T12:42:49.836850345Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in call 2023-08-07T12:42:49.836873760Z return await self.app(scope, receive, send) 2023-08-07T12:42:49.836894542Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 276, in call 2023-08-07T12:42:49.836926502Z await super().call(scope, receive, send) 2023-08-07T12:42:49.836950069Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in call 2023-08-07T12:42:49.836971616Z await self.middleware_stack(scope, receive, send) 2023-08-07T12:42:49.836999473Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in call 2023-08-07T12:42:49.837026765Z raise exc 2023-08-07T12:42:49.837047857Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in call 2023-08-07T12:42:49.837072172Z await self.app(scope, receive, _send) 2023-08-07T12:42:49.837101424Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in call 2023-08-07T12:42:49.837123648Z await responder(scope, receive, send) 2023-08-07T12:42:49.837144353Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in call 2023-08-07T12:42:49.837175632Z await self.app(scope, receive, self.send_with_gzip) 2023-08-07T12:42:49.837199119Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in call 2023-08-07T12:42:49.837220499Z raise exc 2023-08-07T12:42:49.837247363Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in call 2023-08-07T12:42:49.837274973Z await self.app(scope, receive, sender) 2023-08-07T12:42:49.837296050Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in call 2023-08-07T12:42:49.837320440Z raise e 2023-08-07T12:42:49.837349167Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call 2023-08-07T12:42:49.837371641Z await self.app(scope, receive, send) 2023-08-07T12:42:49.837392873Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in call 2023-08-07T12:42:49.837425333Z await route.handle(scope, receive, send) 2023-08-07T12:42:49.837451182Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle 2023-08-07T12:42:49.837473497Z await self.app(scope, receive, send) 2023-08-07T12:42:49.837502346Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app 2023-08-07T12:42:49.837528001Z response = await func(request) 2023-08-07T12:42:49.837548983Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app 2023-08-07T12:42:49.837574183Z raw_response = await run_endpoint_function( 2023-08-07T12:42:49.837602852Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 165, in run_endpoint_function 2023-08-07T12:42:49.837628414Z return await run_in_threadpool(dependant.call, *values) 2023-08-07T12:42:49.837651859Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool 2023-08-07T12:42:49.837683068Z return await anyio.to_thread.run_sync(func, args) 2023-08-07T12:42:49.837705100Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync 2023-08-07T12:42:49.837726312Z return await get_asynclib().run_sync_in_worker_thread( 2023-08-07T12:42:49.837757659Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread 2023-08-07T12:42:49.837782214Z return await future 2023-08-07T12:42:49.837803216Z File "/opt/pysetup/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run 2023-08-07T12:42:49.837831816Z result = context.run(func, *args) 2023-08-07T12:42:49.837858123Z File "/app/mealie/routes/groups/controller_migrations.py", line 64, in start_data_migration 2023-08-07T12:42:49.837879782Z return migrator.migrate(f"{migration_type.value.title()} Migration") 2023-08-07T12:42:49.837904034Z File "/app/mealie/services/migrations/_migration_base.py", line 107, in migrate 2023-08-07T12:42:49.837933114Z self._migrate() 2023-08-07T12:42:49.837954641Z File "/app/mealie/services/migrations/nextcloud.py", line 66, in _migrate 2023-08-07T12:42:49.837975663Z recipe = self.clean_recipe_dictionary(nc_dir.recipe) 2023-08-07T12:42:49.838007090Z File "/app/mealie/services/migrations/_migration_base.py", line 223, in clean_recipe_dictionary 2023-08-07T12:42:49.838031272Z recipe_dict = self.rewrite_alias(recipe_dict) 2023-08-07T12:42:49.838052164Z File "/app/mealie/services/migrations/_migration_base.py", line 212, in rewrite_alias 2023-08-07T12:42:49.838080589Z prop_value = alias.func(prop_value) 2023-08-07T12:42:49.838106336Z File "/app/mealie/services/migrations/nextcloud.py", line 88, in parse_time 2023-08-07T12:42:49.838127918Z val_search = re.search(time_part["exp"], time) 2023-08-07T12:42:49.838153792Z File "/usr/local/lib/python3.10/re.py", line 200, in search 2023-08-07T12:42:49.838183412Z return _compile(pattern, flags).search(string) 2023-08-07T12:42:49.838205199Z TypeError: expected string or bytes-like object

Mealie Version

Latest (issue is present on the demo)

Deployment

Other

Additional Deployment Details

Using the truecharts on truenas

michael-genson commented 1 year ago

Can you provide your NextCloud export file? Looks like I screwed something up in https://github.com/mealie-recipes/mealie/pull/2434

sabatmonk commented 1 year ago

nextcloud.zip

michael-genson commented 1 year ago

Thanks! Found the bug, submitting a PR soon. In the meantime, I've slightly modified your file so the import works (I checked on the demo). If you have a bigger zip file you're intending to import I'd be happy to patch it for you in the meantime.

nextcloud-patched.zip