Skip to content

[BUG] Missing 'search' param causes 'service-by-id' crash #916

@matKlju

Description

@matKlju

Bug description:

"Export many" does not pass the optional search parameter to POST /v2/private/services/service-by-id.

The service-by-id DSL expects search in the request body. When the frontend omits it, incoming.body.search becomes null, and that null is later forwarded into get_endpoints_by_service_id. This causes a backend crash in ScriptingHelper because Java Collectors.toMap() does not accept null values.

The fix is to default search to an empty string in the DSL when it is not provided.

Expected behavior:

"Export many" should work even when no search value is provided.

If search is missing from the request body, the DSL should assign it as an empty string ('') instead of null, so downstream steps do not fail.

Screenshots:
'Search' not providede:
Image

index-c1455ad3.js:213 
 POST https://ruuter.test.buerokratt.ee/v2/private/services/service-by-id 500 (Internal Server Error)

index-c1455ad3.js:216 Teenusele puudub ligipääs. Proovi hiljem uuesti.
index-c1455ad3.js:213 Uncaught (in promise) 
Nt {message: 'Request failed with status code 500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', config: {…}, request: XMLHttpRequest, …}
code
: 
"ERR_BAD_RESPONSE"
config
: 
{transitional: {…}, adapter: Array(3), transformRequest: Array(1), transformResponse: Array(1), timeout: 0, …}
message
: 
"Request failed with status code 500"
name
: 
"AxiosError"
request
: 
XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: true, upload: XMLHttpRequestUpload, …}
response
: 
{data: '', status: 500, statusText: '', headers: XC, config: {…}, …}
status
: 
500
stack
: 
"AxiosError: Request failed with status code 500\n    at dz (https://admin.test.buerokratt.ee/services/assets/index-c1455ad3.js:213:1107)\n    at XMLHttpRequest.c (https://admin.test.buerokratt.ee/services/assets/index-c1455ad3.js:213:5911)\n    at l2.<anonymous> (https://admin.test.buerokratt.ee/services/assets/index-c1455ad3.js:215:2119)\n    at Generator.throw (<anonymous>)\n    at o (https://admin.test.buerokratt.ee/services/assets/index-c1455ad3.js:1:952)"
[[Prototype]]
: 
Error

Additional information:

Request:

  • URL: https://ruuter.buerokratt.rit.ee/v2/private/services/service-by-id
  • Method: POST

Relevant frontend call pattern:

serviceResponse = await api.post<Service>(getServiceById(), { id, search: search ?? '' });

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv3.2

    Type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions