Skip to content

Commit 3e6527a

Browse files
author
Theodore Li
committed
Handle required fields correctly for hosted keys
1 parent 2cdb896 commit 3e6527a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

apps/sim/blocks/types.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,7 @@ export interface SubBlockConfig {
243243
hidden?: boolean
244244
hideFromPreview?: boolean // Hide this subblock from the workflow block preview
245245
requiresFeature?: string // Environment variable name that must be truthy for this subblock to be visible
246-
/**
247-
* Hide this subblock when running on hosted Sim (isHosted is true).
248-
* Used for tool API key fields that should be hidden when Sim provides hosted keys.
249-
*/
250-
hideWhenHosted?: boolean
246+
hideWhenHosted?: boolean // Hide this subblock when running on hosted sim
251247
description?: string
252248
tooltip?: string // Tooltip text displayed via info icon next to the title
253249
value?: (params: Record<string, any>) => string

apps/sim/serializer/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
isCanonicalPair,
1111
isNonEmptyValue,
1212
isSubBlockFeatureEnabled,
13+
isSubBlockHiddenByHostedKey,
1314
resolveCanonicalMode,
1415
} from '@/lib/workflows/subblocks/visibility'
1516
import { getBlock } from '@/blocks'
@@ -49,6 +50,7 @@ function shouldSerializeSubBlock(
4950
canonicalModeOverrides?: CanonicalModeOverrides
5051
): boolean {
5152
if (!isSubBlockFeatureEnabled(subBlockConfig)) return false
53+
if (isSubBlockHiddenByHostedKey(subBlockConfig)) return false
5254

5355
if (subBlockConfig.mode === 'trigger') {
5456
if (!isTriggerContext && !isTriggerCategory) return false

apps/sim/tools/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { generateInternalToken } from '@/lib/auth/internal'
33
import { getBYOKKey } from '@/lib/api-key/byok'
44
import { logFixedUsage } from '@/lib/billing/core/usage-log'
55
import { env } from '@/lib/core/config/env'
6+
import { isHosted } from '@/lib/core/config/feature-flags'
67
import { DEFAULT_EXECUTION_TIMEOUT_MS } from '@/lib/core/execution-limits'
78
import {
89
secureFetchWithPinnedIP,
@@ -61,6 +62,7 @@ async function injectHostedKeyIfNeeded(
6162
requestId: string
6263
): Promise<boolean> {
6364
if (!tool.hosting) return false
65+
if (!isHosted) return false
6466

6567
const { envKeys, apiKeyParam, byokProviderId } = tool.hosting
6668
const userProvidedKey = params[apiKeyParam]

apps/sim/tools/serper/search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const searchTool: ToolConfig<SearchParams, SearchResponse> = {
4343
},
4444
apiKey: {
4545
type: 'string',
46-
required: false,
46+
required: true,
4747
visibility: 'user-only',
4848
description: 'Serper API Key',
4949
},

0 commit comments

Comments
 (0)