Skip to content

fix(connect): handle null value sections in connector config validation#2485

Open
isliao613 wants to merge 1 commit into
redpanda-data:masterfrom
isliao613:fix/connector-null-value-config-crash
Open

fix(connect): handle null value sections in connector config validation#2485
isliao613 wants to merge 1 commit into
redpanda-data:masterfrom
isliao613:fix/connector-null-value-config-crash

Conversation

@isliao613

Copy link
Copy Markdown

Summary

Debezium Oracle 3.5.x returns "value": null for deprecated XStream properties (e.g. database.out.server.name) in the Kafka Connect /connector-plugins/.../config/validate response. The Console UI crashed in three places when encountering these null value sections.

Crash 1 — createCustomProperties in state.ts:
TypeError: Cannot read properties of null (reading 'length')
at p.value.errors.length > 0
Fix: filter null-value entries with a type predicate before mapping; add errors ?? [] guard.

Crash 2 — validate() in state.ts:
TypeError: Cannot read properties of null (reading 'isEqual')
at suggestedSrc.isEqual(suggestedTar)
at target.errors.isEqual(source.errors)
Fix: ?? [] guards before .isEqual() calls.

Crash 3 — transitionConditionMet / getDataSource in create-connector.tsx:
TypeError: Cannot read properties of null (reading 'length')
at transitionConditionMet
Fix: value?.errors ?? [] guard on errorCount sum and getDataSource filter.

Type changes

  • ConnectorProperty.value widened to {...} | null
  • Added ConnectorPropertyWithValue type predicate
  • recommended_values and errors inside value widened to string[] | null

Test plan

  • Unit tests added in state.test.ts covering all three null-value crash scenarios
  • Unit tests added in create-connector.test.ts covering getDataSource with null value sections
  • Manually verified end-to-end: Oracle connector creation wizard navigates through all steps without crashing against a Debezium Oracle 3.5.1 connector

Debezium Oracle 3.5.x returns null value sections for deprecated
XStream properties (e.g. database.out.server.name). Three crash sites
fixed across the connector UI:

- createCustomProperties in state.ts: filter null-value entries before
  mapping, add errors ?? [] guard
- validate() in state.ts: null guards on recommended_values and errors
  before isEqual comparisons
- transitionConditionMet and getDataSource in create-connector.tsx:
  value?.errors ?? [] guard on errorCount sum and filter

Also updates ConnectorProperty type to allow value: null, adds
ConnectorPropertyWithValue predicate type, and adds unit tests covering
all three null-value cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant