Skip to content

Commit 2d3b68b

Browse files
committed
fix(okta): drop non-numeric limit and priority instead of sending NaN
Both fields are free-text inputs coerced with Number(), so a stray non-numeric entry became NaN and serialized to null, which Okta rejects with a validation error pointing at the wrong field. Omit the field instead so Okta applies its own default.
1 parent 7022394 commit 2d3b68b

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

apps/sim/blocks/blocks/okta.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@ import type { BlockConfig, BlockMeta } from '@/blocks/types'
33
import { IntegrationType } from '@/blocks/types'
44
import type { OktaResponse } from '@/tools/okta/types'
55

6+
/**
7+
* Coerces a numeric subBlock value, dropping anything that is not a real number.
8+
*
9+
* These fields are free-text inputs, so a stray non-numeric entry would otherwise
10+
* become `NaN` and serialize to `null`, which Okta rejects with a validation
11+
* error that points at the wrong thing. Omitting the field instead lets Okta
12+
* apply its own default.
13+
*/
14+
function toFiniteNumber(value: unknown): number | undefined {
15+
if (value === undefined || value === null || value === '') return undefined
16+
const parsed = Number(value)
17+
return Number.isFinite(parsed) ? parsed : undefined
18+
}
19+
620
export const OktaBlock: BlockConfig<OktaResponse> = {
721
type: 'okta',
822
name: 'Okta',
@@ -896,10 +910,11 @@ export const OktaBlock: BlockConfig<OktaResponse> = {
896910
domain: params.domain,
897911
}
898912

899-
if (params.limit) result.limit = Number(params.limit)
900-
if (params.priority !== undefined && params.priority !== null && params.priority !== '') {
901-
result.priority = Number(params.priority)
902-
}
913+
const limit = toFiniteNumber(params.limit)
914+
if (limit !== undefined) result.limit = limit
915+
916+
const priority = toFiniteNumber(params.priority)
917+
if (priority !== undefined) result.priority = priority
903918

904919
// Map group-specific UI fields to tool param names
905920
if (params.groupName) result.name = params.groupName

0 commit comments

Comments
 (0)