Skip to content

DataSonnetPipe throws "Unrecognized token '$'" when jsonInputValidator 'failureReason' sessionKey is the input #10352

@MLenterman

Description

@MLenterman

Current Behavior

The "failureReason" sessionkey produced by a JsonInputValidator contains '$' for some reason. When using this sessionkey as input in a DataSonnetPipe it throws the error. It seems to be trying to parse it as json, so perhaps the computeMimeType functionality is incorrectly thinking the failureReason sessionkey to be json, or perhaps the sessionkey is supposed to be json(but is bugged) and has the json mimeType.

Possibly the core issue could be the JsonInputValidator producing malformed json as failureReason. The format looks somewhat like it wants to be json.

Expected Behavior

failureReason sessionkey should not be interpreted as json if it is not intended to be json.

If JsonInputValidator failureReason is not bugged, it would be great if it can be changed to something that is easy to process. In dont mind if it is as simple as a comma-seperated string, json, xml, csv or whatever, but the current format makes no sense at all.

Environment Information

FF! 9.4.0: Eekels-Webhook-API 1.3.2
Running on ee245b133830 using Apache Tomcat/11.0.15
Java Version: OpenJDK Runtime Environment (21.0.9+10-LTS)
Heap size: 240.9 MiB, total JVM memory: 388.0 MiB
Free memory: 147.1 MiB, max memory: 3.8 GiB
Free disk space: 962.6 GiB, total disk space: 1006.9 GiB
Up since: 2026-01-30 16:05:19, timezone: Etc/UTC

Steps To Reproduce

DataSonnetPipe stylesheet can be any arbitrary jsonnet that references payload.

Configuration

<JsonInputValidator
    schema="/model/jsonSchema/Webhook.json">
    <Forward name="success" path="GenerateUuid" />
    <Forward name="failure" path="JsonApiErrorDocument" />
    <Forward name="exception" path="Internal Server Error" />
</JsonInputValidator>
<DataSonnetPipe
    name="JsonApiErrorDocument"
    getInputFromSessionKey="failureReason"
    styleSheetName="model/jsonnet/JsonApiErrorDocument_FromJsonValidator.jsonnet">
    <Param name="status" value="400" />
    <Param name="pointer" value="Webhooks-webhooks_create" />
    <Forward name="success" path="Bad Request" />
    <Forward name="exception" path="Bad Request" />
</DataSonnetPipe>

Input

[$: required property 'idempotencyKey' not found, $: required property 'name' not found, $: required property 'eventTypes' not found, $: required property 'notificationUrl' not found, $: required property 'signatureKey' not found, $: required property 'status' not found]

What database are you using?

No response

What browsers are you seeing the problem on?

No response

Relevant Log Output

Failed to parse JSON: Unrecognized token '$': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')  at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 3]">
	<location class="org.frankframework.pipes.DataSonnetPipe" name="JsonApiErrorDocument"/>
	<details>java.lang.Exception: Failed to parse JSON: Unrecognized token '$': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 3]
	at com.datasonnet.spi.ujsonUtils$.replaceLargeNumbers(ujsonUtils.scala:60)
	at com.datasonnet.spi.ujsonUtils$.parse(ujsonUtils.scala:43)
	at com.datasonnet.spi.ujsonUtils.parse(ujsonUtils.scala)
	at com.datasonnet.plugins.DefaultJSONFormatPlugin.read(DefaultJSONFormatPlugin.java:70)
	at com.datasonnet.spi.DataFormatService.mandatoryRead(DataFormatService.java:76)
	at com.datasonnet.Mapper.transform(Mapper.scala:246)
	at com.datasonnet.Mapper.transform(Mapper.scala:239)
	at org.frankframework.json.DataSonnetUtil.transform(DataSonnetUtil.java:179)
	at org.frankframework.pipes.DataSonnetPipe.doPipe(DataSonnetPipe.java:149)
	at org.frankframework.processors.CorePipeProcessor.processPipe(CorePipeProcessor.java:36)

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions