Skip to content

Backend crashes when trying to use companion #4570

@dbadura

Description

@dbadura

Description
When I was working with my k3d (I know, chat doesn't work with local k3d but I don't know if problem lies here) and typed something to chat. The backend crashes.
My configuration:
busola:

KYMA_COMPANION enabled

backend:

default config.

Expected result

Even if chat is not available to use with k3d, the error shouldn't crash backend.

Actual result

Error log:

[backend] {"level":40,"time":1769785574830,"pid":147550,"hostname":"computer","req":{"id":"8ae6c486-a44e-45ab-a560-7beb7df4d6b9","method":"POST","url":"/backend/ai-chat/messages","apiServerAddress":"https://0.0.0.0:43963"},"err":{"type":"Error","message":"Invalid session ID ","stack":"Error: Invalid session ID \n    at handler (/busola/backend/companion/companionRouter.js:133:13)\n    at wrapper (/busola/backend/logging/index.js:34:5)\n    at Layer.handleRequest (/busola/backend/node_modules/router/lib/layer.js:152:17)\n    at next (/busola/backend/node_modules/router/lib/route.js:157:13)\n    at /busola/backend/node_modules/express-rate-limit/dist/index.cjs:807:7\n    at processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at /busola/backend/node_modules/express-rate-limit/dist/index.cjs:691:5"},"msg":"Invalid session ID "}
[backend] /busola/backend/node_modules/express/lib/response.js:67
[backend]     throw new TypeError(`Invalid status code: ${JSON.stringify(code)}. Status code must be an integer.`);
[backend]           ^
[backend] 
[backend] TypeError: Invalid status code: undefined. Status code must be an integer.
[backend]     at ServerResponse.status (/busola/backend/node_modules/express/lib/response.js:67:11)
[backend]     at handler (/busola/backend/companion/companionRouter.js:171:11)
[backend]     at wrapper (/busola/backend/logging/index.js:34:5)
[backend]     at Layer.handleRequest (/busola/backend/node_modules/router/lib/layer.js:152:17)
[backend]     at next (/busola/backend/node_modules/router/lib/route.js:157:13)
[backend]     at /busola/backend/node_modules/express-rate-limit/dist/index.cjs:807:7
[backend]     at processTicksAndRejections (node:internal/process/task_queues:105:5)
[backend]     at /busola/backend/node_modules/express-rate-limit/dist/index.cjs:691:5
[backend] 
[backend] Node.js v22.18.0

Steps to reproduce

Troubleshooting

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.kyma companionRelated to all activities around the Kyma Companion

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions