Skip to content

[BUG] Handlebars helper crashes on numeric input #976

@matKlju

Description

@matKlju

Bug description:
Handlebars helper escapeQuotes crashes when input is not a string.
If a number (e.g. 1.6337) is passed, .replaceAll() is called on a non-string value, causing a runtime error.

Expected behavior:
Helper must handle numeric input types and safely process them without errors.

Steps to reproduce:

  • import embedded service
  • save and run test widget
  • observe unknown error in wdget
  • network response contains errot:
    • "There was an error executing /workspace/app/module/services/hbs/bot_responses_to_messages.handlebars"

Example service with numeric API response:
rahvaarvu_teenus_2026_04_27_23_22_43.json

Network log:
Response:

{
    "response": {
        "error": "There was an error executing /workspace/app/module/services/hbs/bot_responses_to_messages.handlebars"
    }
}

DataMapper log:

Request: {method: POST, url: /services/hbs/bot_responses_to_messages, params: {}, query: {}, body: {"data":{"authorLastName":"","buttons":[],"chatId":"","botMessages":[{"result":1.6337}],"authorFirstName":"","created":"2026-04-27T20:18:15.296Z","authorTimestamp":"2026-04-27T20:18:15.295Z","authorId":""}}}
err: TypeError: text.replaceAll is not a function
    at Object.escapeQuotes (/workspace/app/lib/helpers.js:108:17)

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