SelfhostedPro / selfhosted_templates

Portainer templates for selfhosted services
GNU General Public License v3.0
1.22k stars 238 forks source link

[BUG] Unable to add second template: "Internal Server Error: undefined" #259

Open JPDucky opened 2 years ago

JPDucky commented 2 years ago

Describe the bug A clear and concise description of what the bug is. When attempting to add an additional template (after having already added, and used, the first/recommended), after filling out the "Title" and "URL" then clicking on "Submit", you are brought back to the 'Templates' page and a toast pops up with the error: "Internal Server Error: undefined" and nothing is added.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Templates'
  2. Click on 'the add(+) button'
  3. Enter information into the 'Title' and 'URL' fields
  4. Click 'Submit'
  5. Error message occurs and nothing is added

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

  1. Go to 'Templates'
  2. Click on 'the add(+) button'
  3. Enter information into the 'Title' and 'URL' fields
  4. Click 'Submit'
  5. You are brought back to the templates page and now see the the new template

Screenshots If applicable, add screenshots to help explain your problem. https://imgur.com/a/RdgkJw5

Portainer Logs Paste logs here ` ERROR: Exception in ASGI application

Traceback (most recent call last):

File "/usr/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi

 result = await app(self.scope, self.receive, self.send)

File "/usr/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in call

 return await self.app(scope, receive, send)

File "/usr/lib/python3.8/site-packages/fastapi/applications.py", line 199, in call

 await super().__call__(scope, receive, send)

File "/usr/lib/python3.8/site-packages/starlette/applications.py", line 111, in call

 await self.middleware_stack(scope, receive, send)

File "/usr/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in call

 raise exc from None

File "/usr/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in call

 await self.app(scope, receive, _send)

File "/usr/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in call

 raise exc from None

File "/usr/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in call

 await self.app(scope, receive, sender)

File "/usr/lib/python3.8/site-packages/starlette/routing.py", line 566, in call

 await route.handle(scope, receive, send)

File "/usr/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle

 await self.app(scope, receive, send)

File "/usr/lib/python3.8/site-packages/starlette/routing.py", line 41, in app

 response = await func(request)

File "/usr/lib/python3.8/site-packages/fastapi/routing.py", line 201, in app

 raw_response = await run_endpoint_function(

File "/usr/lib/python3.8/site-packages/fastapi/routing.py", line 150, in run_endpoint_function

 return await run_in_threadpool(dependant.call, **values)

File "/usr/lib/python3.8/site-packages/starlette/concurrency.py", line 34, in run_in_threadpool

 return await loop.run_in_executor(None, func, *args)

File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run

 result = self.fn(*self.args, **self.kwargs)

File "/./api/routers/templates.py", line 61, in add_template

 return crud.add_template(db=db, template=template)

File "/./api/db/crud/templates.py", line 107, in add_template

 title=entry["title"],

KeyError: 'title'

ERROR: Exception in ASGI application

Traceback (most recent call last):

File "/usr/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi

 result = await app(self.scope, self.receive, self.send)

File "/usr/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in call

 return await self.app(scope, receive, send)

File "/usr/lib/python3.8/site-packages/fastapi/applications.py", line 199, in call

 await super().__call__(scope, receive, send)

File "/usr/lib/python3.8/site-packages/starlette/applications.py", line 111, in call

 await self.middleware_stack(scope, receive, send)

File "/usr/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in call

 raise exc from None

File "/usr/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in call `