500 Error when trying to view Knowledge Base when signed in

Infos:

  • Used Zammad version: 6.2
  • Used Zammad installation type: Package
  • Operating system: Ubuntu 22.04
  • Browser + version: Chrome v120

Expected behavior:

  • When a user is not signed in to Zammad, the Knowledge Base URL opens the KB correctly
  • When a user is signed in to Zammad, and they have permissions to edit the KB, opening the KB should work the same

Actual behavior:

  • When a user is signed in to Zammad, and they have permissions to edit the KB, opening the KB from the KB editor button at the top right results in 500 error
  • Going to the KB URL directly when signed in also results in a 500 error

Steps to reproduce the behavior:

  • Open the KB URL without signing in, it will work correctly, then sign in with the test user account on the Zammad URL and refresh the KB URL, you will see a 500 error. The Agent account has all the permissions I can find for KB.

Hi @shrisham. I removed the credentials you’ve posted to prevent any harm to your system.

You have to check your production.log for the situation you’ve described.

Hello!

Thank you for pointing me to the logs, here is what I see when I try to click the knowledge base button when I am logged in as an admin or an agent with KB access, it seems to be expecting a port component and is erroring out with or without a preview_token present in the request url.

Any help here would be greatly appreciated. I cannot ship a system where logged in users cant see the KB that they are supposed to create and maintain.

URL: /help/en-us?preview_token=ViAka-bSzBcIx8kcED5RPQ9VosymB6Iz1-e1Hfn2bQ5A94FF50G4-XonvareaGgE
Log:

I, [2024-01-24T19:18:30.076186#452-143260]  INFO -- : Started GET "/help/en-us?preview_token=ViAka-bSzBcIx8kcED5RPQ9VosymB6Iz1-e1Hfn2bQ5A94FF50G4-XonvareaGgE" for 97.126.115.237 at 2024-01-24 19:18:30 +0000
I, [2024-01-24T19:18:30.080511#452-143260]  INFO -- : Processing by KnowledgeBase::Public::CategoriesController#index as HTML
I, [2024-01-24T19:18:30.080607#452-143260]  INFO -- :   Parameters: {"preview_token"=>"ViAka-bSzBcIx8kcED5RPQ9VosymB6Iz1-e1Hfn2bQ5A94FF50G4-XonvareaGgE", "locale"=>"en-us"}
I, [2024-01-24T19:18:30.126771#452-143260]  INFO -- :   Rendered knowledge_base/public/categories/index.html.erb within layouts/knowledge_base (Duration: 13.9ms | Allocations: 6325)
I, [2024-01-24T19:18:30.129663#452-143260]  INFO -- :   Rendered layout layouts/knowledge_base.html.erb (Duration: 16.8ms | Allocations: 7453)
E, [2024-01-24T19:18:30.129843#452-143260] ERROR -- : bad component(expected port component): "//helpdesk.leftovers.today" (ActionView::Template::Error)
app/helpers/knowledge_base_helper.rb:59:in `build_zammad_link'
app/helpers/knowledge_base_helper.rb:51:in `build_kb_link'
app/views/knowledge_base/public/_top_banner.html.erb:14
app/helpers/knowledge_base_top_bar_helper.rb:45:in `render_top_bar_if_needed'
app/views/layouts/knowledge_base.html.erb:20
app/controllers/application_controller/has_download.rb:17:in `block (4 levels) in <module:HasDownload>'
app/controllers/application_controller/has_download.rb:16:in `block (3 levels) in <module:HasDownload>'
app/controllers/application_controller/has_download.rb:15:in `block (2 levels) in <module:HasDownload>'
app/controllers/application_controller/handles_transitions.rb:16:in `handle_transaction'
I, [2024-01-24T19:18:30.133043#452-143260]  INFO -- :   Rendered inline template (Duration: 0.3ms | Allocations: 242)
I, [2024-01-24T19:18:30.133174#452-143260]  INFO -- : Completed 500 Internal Server Error in 53ms (Views: 0.6ms | ActiveRecord: 12.5ms | Allocations: 25731)

URL: /help/en-us
Log:

I, [2024-01-24T19:27:50.293357#452-141940]  INFO -- : Started GET "/help/en-us" for 97.126.115.237 at 2024-01-24 19:27:50 +0000
I, [2024-01-24T19:27:50.297778#452-141940]  INFO -- : Processing by KnowledgeBase::Public::CategoriesController#index as HTML
I, [2024-01-24T19:27:50.297909#452-141940]  INFO -- :   Parameters: {"locale"=>"en-us"}
I, [2024-01-24T19:27:50.341416#452-141940]  INFO -- :   Rendered knowledge_base/public/categories/index.html.erb within layouts/knowledge_base (Duration: 12.3ms | Allocations: 6330)
I, [2024-01-24T19:27:50.343951#452-141940]  INFO -- :   Rendered layout layouts/knowledge_base.html.erb (Duration: 14.8ms | Allocations: 7484)
E, [2024-01-24T19:27:50.344127#452-141940] ERROR -- : bad component(expected port component): "//helpdesk.leftovers.today" (ActionView::Template::Error)
app/helpers/knowledge_base_helper.rb:59:in `build_zammad_link'
app/helpers/knowledge_base_helper.rb:51:in `build_kb_link'
app/views/knowledge_base/public/_top_banner.html.erb:14
app/helpers/knowledge_base_top_bar_helper.rb:45:in `render_top_bar_if_needed'
app/views/layouts/knowledge_base.html.erb:20
app/controllers/application_controller/handles_transitions.rb:16:in `handle_transaction'
I, [2024-01-24T19:27:50.346824#452-141940]  INFO -- :   Rendered inline template (Duration: 0.3ms | Allocations: 247)
I, [2024-01-24T19:27:50.346950#452-141940]  INFO -- : Completed 500 Internal Server Error in 49ms (Views: 0.6ms | ActiveRecord: 11.6ms | Allocations: 25818)

But when I am not logged in, it does not expect a port component and renders the knowledge base correctly:

URL: /help/en-us

I, [2024-01-24T19:26:43.478818#452-143260]  INFO -- : Started GET "/help/en-us" for 104.28.116.106 at 2024-01-24 19:26:43 +0000
I, [2024-01-24T19:26:43.483249#452-143260]  INFO -- : Processing by KnowledgeBase::Public::CategoriesController#index as HTML
I, [2024-01-24T19:26:43.483295#452-143260]  INFO -- :   Parameters: {"locale"=>"en-us"}
I, [2024-01-24T19:26:43.507179#452-143260]  INFO -- :   Rendered knowledge_base/public/categories/index.html.erb within layouts/knowledge_base (Duration: 2.0ms | Allocations: 763)
I, [2024-01-24T19:26:43.520694#452-143260]  INFO -- :   Rendered layout layouts/knowledge_base.html.erb (Duration: 15.5ms | Allocations: 7444)
I, [2024-01-24T19:26:43.521844#452-143260]  INFO -- : Completed 200 OK in 38ms (Views: 12.0ms | ActiveRecord: 10.6ms | Allocations: 14524)

How’s your fqdn looking?

Here are the URLs with FQDN, thank you for your help!

This is the URL I see in the browser tab when Im logged in (had a add a space after // so i can post it)
https:// helpdesk.leftovers.today/#knowledge_base/2/locale/en-us

This is the URL I see when I hover over the preview button for the KB:
https:// helpdesk.leftovers.today/api/v1/knowledge_bases/preview/KnowledgeBase/2/en-us

This is the URL in the browser tab when I click on the preview button for the KB that results in a 500 error:
https:// helpdesk.leftovers.today/help/en-us?preview_token=Ry4h6fd6ixeK1IeGkS07y0RyUzeSI3_LCtWPaZ3V4zVqpDbA6My8J8HyM_PNX5QB

This is the URL a non logged in person sees which works fine:
https:// helpdesk.leftovers.today/help/en-us

This topic was automatically closed 360 days after the last reply. New replies are no longer allowed.