Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(cdp): fail clearly when a function's integration no longer exists (#116062)

Daniel Marchukd0ac9bf356dd
diff --git a/frontend/src/lib/components/CyclotronJob/CyclotronJobInputsValidation.test.ts b/frontend/src/lib/components/CyclotronJob/CyclotronJobInputsValidation.test.ts
index 9045f52a0618..b65d1751ce98 100644
--- a/frontend/src/lib/components/CyclotronJob/CyclotronJobInputsValidation.test.ts
+++ b/frontend/src/lib/components/CyclotronJob/CyclotronJobInputsValidation.test.ts
@@ -1,6 +1,10 @@
import { CyclotronJobInputSchemaType, CyclotronJobInputType } from '~/types'
-import { CyclotronJobInputsValidation, TEMPLATING_MISMATCH_WARNINGS } from './CyclotronJobInputsValidation'
+import {
+ CyclotronJobInputsValidation,
+ MISSING_INTEGRATION_ERROR,
+ TEMPLATING_MISMATCH_WARNINGS,
+} from './CyclotronJobInputsValidation'
describe('CyclotronJobInputsValidation', () => {
describe('validate', () => {
@@ -149,6 +153,24 @@ describe('CyclotronJobInputsValidation', () => {
expect(result.valid).toBe(false)
expect(result.errors.integration).toBe('Value must be an Integration ID')
})
+
+ it.each([
+ ['the integration was deleted', [{ id: 2 }], MISSING_INTEGRATION_ERROR],
+ ['the integration exists', [{ id: 1 }, { id: 2 }], undefined],
+ ['integrations have not loaded', null, undefined],
+ ])('flags a missing integration only when %s', (_name, integrations, expected) => {
+ const schema: CyclotronJobInputSchemaType[] = [
+ { key: 'integration', type: 'integration', label: 'Integration' },
+ ]
+
+ const result = CyclotronJobInputsValidation.validate(
+ { integration: { value: 1 } },
+ schema,
+ integrations
+ )
+
+ expect(result.errors.integration).toBe(expected)
+ })
})
describe('JSON validation', () => {
diff --git a/frontend/src/lib/components/CyclotronJob/CyclotronJobInputsValidation.ts b/frontend/src/lib/components/CyclotronJob/CyclotronJobInputsValidation.ts
index c653e378d8bc..f3c33b3f1f8c 100644
--- a/frontend/src/lib/components/CyclotronJob/CyclotronJobInputsValidation.ts
+++ b/frontend/src/lib/components/CyclotronJob/CyclotronJobInputsValidation.ts
@@ -209,17 +209,28 @@ const validateInput = (input: CyclotronJobInputType, inputSchema: CyclotronJobIn
}
}
}
+export const MISSING_INTEGRATION_ERROR =
+ 'This integration no longer exists. It may have been deleted. Select a connected integration.'
+
export class CyclotronJobInputsValidation {
static validate(
inputs: Record<string, CyclotronJobInputType>,
- inputsSchema: CyclotronJobInputSchemaType[]
+ inputsSchema: CyclotronJobInputSchemaType[],
+ integrations?: { id: number }[] | null
): CyclotronJobInputsValidationResult {
const inputErrors: Record<string, string> = {}
const inputWarnings: Record<string, string> = {}
inputsSchema?.forEach((inputSchema) => {
const input = inputs[inputSchema.key]
- const error = validateInput(input, inputSchema)
+ const error =
+ validateInput(input, inputSchema) ??
+ (inputSchema.type === 'integration' &&
+ integrations &&
+ typeof input?.value === 'number' &&
+ !integrations.some((integration) => integration.id === input.value)
+ ? MISSING_INTEGRATION_ERROR
+ : undefined)
if (error) {
inputErrors[inputSchema.key] = error
}
diff --git a/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx b/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx
index b34afb03e761..5cccb4cb20e2 100644
--- a/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx
+++ b/frontend/src/lib/components/CyclotronJob/integrations/IntegrationChoice.tsx
@@ -198,8 +198,8 @@ export function IntegrationChoice({
) : valueIsMissing ? (
<div className="flex flex-col gap-2">
<LemonBanner type="warning">
- The previously selected {kindName} connection (ID: {value}) is no longer available. Pick a
- different connection or clear the selection — this connection will fail at runtime otherwise.
+ The previously selected {kindName} connection (ID: {value}) is no longer available, so this will
+ fail when it runs. Pick a different connection or clear the selection.
</LemonBanner>
{button}
</div>
diff --git a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx
index 35384f6b2fc3..2b31bf8d82e5 100644
--- a/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx
+++ b/frontend/src/scenes/hog-functions/configuration/hogFunctionConfigurationLogic.tsx
@@ -30,6 +30,7 @@ import {
CyclotronJobInputsValidationResult,
} from 'lib/components/CyclotronJob/CyclotronJobInputsValidation'
import { dayjs } from 'lib/dayjs'
+import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { deleteWithUndo } from 'lib/utils/deleteWithUndo'
import { uuid } from 'lib/utils/dom'
import { addProductIntent } from 'lib/utils/product-intents'
@@ -78,6 +79,7 @@ import {
Survey,
SurveyEventName,
SurveyEventProperties,
+ IntegrationType,
} from '~/types'
import { asDisplay } from 'products/persons/frontend/person-utils'
@@ -343,6 +345,7 @@ export function mightDropEvents(code: string): boolean {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface hogFunctionConfigurationLogicValues {
groupTypes: Map<GroupTypeIndex, GroupType> // groupsModel
+ integrations: IntegrationType[] | null // integrationsLogic
currentProject: ProjectType | null // projectLogic
currentProjectId: number | null // projectLogic
currentTeam: TeamPublicType | TeamType | null // teamLogic
@@ -736,7 +739,10 @@ export interface hogFunctionConfigurationLogicMeta {
loading: (hogFunctionLoading: boolean, templateLoading: boolean) => boolean
loaded: (hogFunction: HogFunctionType | null, template: HogFunctionTemplateType | null) => boolean
contextId: (configuration: HogFunctionConfigurationType) => HogFunctionConfigurationContextId
- inputsValidation: (configuration: HogFunctionConfigurationType) => CyclotronJobInputsValidationResult
+ inputsValidation: (
+ configuration: HogFunctionConfigurationType,
+ integrations: IntegrationType[] | null
+ ) => CyclotronJobInputsValidationResult
inputFormErrors: (inputsValidation: CyclotronJobInputsValidationResult) => Record<string, string> | null
inputFormWarnings: (inputsValidation: CyclotronJobInputsValidationResult) => Record<string, string>
willReEnableOnSave: (
@@ -848,6 +854,8 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
['hasAvailableFeature'],
teamLogic,
['currentTeam'],
+ integrationsLogic,
+ ['integrations'],
],
})),
actions({
@@ -1375,9 +1383,16 @@ export const hogFunctionConfigurationLogic = kea<hogFunctionConfigurationLogicTy
],
inputsValidation: [
- (s) => [s.configuration],
- (configuration: HogFunctionConfigurationType): CyclotronJobInputsValidationResult =>
- CyclotronJobInputsValidation.validate(configuration.inputs ?? {}, configuration.inputs_schema ?? []),
+ (s) => [s.configuration, s.integrations],
+ (
+ configuration: HogFunctionConfigurationType,
+ integrations: IntegrationType[] | null
+ ): CyclotronJobInputsValidationResult =>
+ CyclotronJobInputsValidation.validate(
+ configuration.inputs ?? {},
+ configuration.inputs_schema ?? [],
+ integrations
+ ),
],
inputFormErrors: [
(s) => [s.inputsValidation],
diff --git a/nodejs/src/cdp/hog-transformations/hog-transformer.service.test.ts b/nodejs/src/cdp/hog-transformations/hog-transformer.service.test.ts
index fe08ea4150be..3bf2ae35fe60 100644
--- a/nodejs/src/cdp/hog-transformations/hog-transformer.service.test.ts
+++ b/nodejs/src/cdp/hog-transformations/hog-transformer.service.test.ts
@@ -935,6 +935,37 @@ describe('HogTransformer', () => {
queueAppMetricSpy.mockRestore()
})
+ it('logs a deleted integration on the transformation and leaves the event unchanged', async () => {
+ const hogFunction = createHogFunction({
+ type: 'transformation',
+ name: 'Uses an integration',
+ team_id: teamId,
+ enabled: true,
+ bytecode: await compileHog(`
+ let returnEvent := event
+ returnEvent.properties.transformed := true
+ return returnEvent
+ `),
+ inputs_schema: [{ key: 'oauth', type: 'integration', required: true }],
+ inputs: { oauth: { value: 99999999 } },
+ execution_order: 1,
+ })
+ await insertHogFunction(hub.postgres, teamId, hogFunction)
+ hogTransformer['hogFunctionManager']['onHogFunctionsReloaded'](teamId, [hogFunction.id])
+
+ const event = createPluginEvent({ event: 'test', properties: {} }, teamId)
+ const result = await hogTransformer.transformEventAndProduceMessages(event)
+
+ expect(result.event?.properties).toEqual({})
+ expect(result.invocationResults).toHaveLength(1)
+ expect(result.invocationResults[0].logs).toEqual([
+ expect.objectContaining({
+ level: 'error',
+ message: expect.stringContaining("The integration for input 'oauth' no longer exists"),
+ }),
+ ])
+ })
+
it('should apply a matching transformation and skip a filtered one in sequence', async () => {
const successTemplate = {
free: true,
diff --git a/nodejs/src/cdp/hog-transformations/hog-transformer.service.ts b/nodejs/src/cdp/hog-transformations/hog-transformer.service.ts
index daf246d9c3d3..f2994e539d03 100644
--- a/nodejs/src/cdp/hog-transformations/hog-transformer.service.ts
+++ b/nodejs/src/cdp/hog-transformations/hog-transformer.service.ts
@@ -9,7 +9,12 @@ import { logger } from '~/common/utils/logger'
import { PubSub } from '~/common/utils/pubsub'
import { PluginEvent, Properties } from '~/plugin-scaffold'
-import { CyclotronJobInvocationResult, HogFunctionInvocationGlobals, HogFunctionType } from '../../cdp/types'
+import {
+ CyclotronJobInvocationResult,
+ HogFunctionInvocationGlobals,
+ HogFunctionInvocationGlobalsWithInputs,
+ HogFunctionType,
+} from '../../cdp/types'
import { isLegacyPluginHogFunction } from '../../cdp/utils'
import type { CommonConfig } from '../../common/config'
import { HogExecutorService } from '../services/hog-executor.service'
@@ -19,8 +24,9 @@ import { HogFunctionManagerService } from '../services/managers/hog-function-man
import { IntegrationManagerService } from '../services/managers/integration-manager.service'
import { HogFunctionMonitoringService, MonitoringOutput } from '../services/monitoring/hog-function-monitoring.service'
import { EncryptedFields } from '../utils/encryption-utils'
+import { HogConfigurationError } from '../utils/hog-error-classification'
import { convertToHogFunctionFilterGlobal, filterFunctionInstrumented } from '../utils/hog-function-filtering'
-import { createInvocation } from '../utils/invocation-utils'
+import { createInputsFailureResult, createInvocation } from '../utils/invocation-utils'
import { RustVmExecutor } from './rust-vm-executor'
import { getTransformationFunctions } from './transformation-functions'
@@ -364,7 +370,16 @@ export class HogTransformerService implements HogTransformer {
globals: HogFunctionInvocationGlobals
): Promise<CyclotronJobInvocationResult> {
const transformationFunctions = await this.getTransformationFunctions()
- const globalsWithInputs = await this.hogExecutor.buildInputsWithGlobals(hogFunction, globals)
+ let globalsWithInputs: HogFunctionInvocationGlobalsWithInputs
+ try {
+ globalsWithInputs = await this.hogExecutor.buildInputsWithGlobals(hogFunction, globals)
+ } catch (error) {
+ // Returned rather than thrown, so the error reaches the transformation's own logs.
+ if (!(error instanceof HogConfigurationError)) {
+ throw error
+ }
+ return createInputsFailureResult(hogFunction, globals, error)
+ }
const invocation = createInvocation(globalsWithInputs, hogFunction)
diff --git a/nodejs/src/cdp/services/batch-export-hog-function.service.test.ts b/nodejs/src/cdp/services/batch-export-hog-function.service.test.ts
index 8a58914341c1..1181657e58f1 100644
--- a/nodejs/src/cdp/services/batch-export-hog-function.service.test.ts
+++ b/nodejs/src/cdp/services/batch-export-hog-function.service.test.ts
@@ -266,6 +266,28 @@ describe('BatchExportHogFunctionService', () => {
})
describe('execution errors', () => {
+ it('returns a failed invocation, not a 500, when an integration was deleted', async () => {
+ hogFunction = await insertHogFunction({
+ ...HOG_EXAMPLES.simple_fetch,
+ ...HOG_FILTERS_EXAMPLES.no_filters,
+ batch_export_id: batchExportId,
+ inputs_schema: [
+ ...(HOG_INPUTS_EXAMPLES.simple_fetch.inputs_schema ?? []),
+ { key: 'oauth', type: 'integration', required: true },
+ ],
+ inputs: { ...HOG_INPUTS_EXAMPLES.simple_fetch.inputs, oauth: { value: 99999999 } },
+ })
+
+ const res = await postInvocation({ clickhouse_event: clickhouseEvent })
+
+ expect(res.status).toEqual(200)
+ expect(res.body.status).toEqual('error')
+ expect(res.body.errors).toEqual([
+ expect.stringContaining("The integration for input 'oauth' no longer exists"),
+ ])
+ expect(mockFetch).not.toHaveBeenCalled()
+ })
+
it('returns error log when fetch returns 500', async () => {
mockFetch.mockImplementation(() =>
Promise.resolve({
diff --git a/nodejs/src/cdp/services/batch-export-hog-function.service.ts b/nodejs/src/cdp/services/batch-export-hog-function.service.ts
index 1ffdc9d45224..c1553c18c1d0 100644
--- a/nodejs/src/cdp/services/batch-export-hog-function.service.ts
+++ b/nodejs/src/cdp/services/batch-export-hog-function.service.ts
@@ -13,7 +13,8 @@ import {
} from '../types'
import { convertToHogFunctionInvocationGlobals } from '../utils'
import { dualWrite } from '../utils/dual-store'
-import { createInvocation } from '../utils/invocation-utils'
+import { HogConfigurationError } from '../utils/hog-error-classification'
+import { createInputsFailureResult, createInvocation } from '../utils/invocation-utils'
import { HogExecutorAsyncService } from './hog-executor-async.service'
import { InvocationResultsService } from './invocation-results.service'
import { GroupsManagerService } from './managers/groups-manager.service'
@@ -86,11 +87,23 @@ export class BatchExportHogFunctionService {
const globals = this.buildRequestGlobals(clickhouse_event as RawClickHouseEvent, hogFunction, team)
await this.groupsManager.addGroupsToGlobals(globals)
- const globalsWithInputs = await this.hogExecutorAsync.hogExecutor.buildInputsWithGlobals(hogFunction, globals)
- const invocation = createInvocation(globalsWithInputs, hogFunction)
- invocation.id = invocationId.toString()
-
- const result = await this.hogExecutorAsync.executeWithAsyncFunctions(invocation, { maxFetchRetries: 0 }) // Retries are handled by the batch export service
+ let result: CyclotronJobInvocationResult<CyclotronJobInvocationHogFunction>
+ try {
+ const globalsWithInputs = await this.hogExecutorAsync.hogExecutor.buildInputsWithGlobals(
+ hogFunction,
+ globals
+ )
+ const invocation = createInvocation(globalsWithInputs, hogFunction)
+ invocation.id = invocationId.toString()
+
+ result = await this.hogExecutorAsync.executeWithAsyncFunctions(invocation, { maxFetchRetries: 0 }) // Retries are handled by the batch export service
+ } catch (error) {
+ // A 500 makes the batch export retry forever, so it never reaches its error threshold.
+ if (!(error instanceof HogConfigurationError)) {
+ throw error
+ }
+ result = createInputsFailureResult(hogFunction, globals, error, invocationId.toString())
+ }
// TODO: Follow up - we might want to more accuratelt link an execution to the fact it came from a batch export
// We have the parent_id but that overrides the function id which is not always what we want
diff --git a/nodejs/src/cdp/services/hog-inputs.service.test.ts b/nodejs/src/cdp/services/hog-inputs.service.test.ts
index de7891268312..6f90e5da7c91 100644
--- a/nodejs/src/cdp/services/hog-inputs.service.test.ts
+++ b/nodejs/src/cdp/services/hog-inputs.service.test.ts
@@ -10,6 +10,7 @@ import { Hub, Team } from '~/types'
import { createHogExecutionGlobals, createHogFunction, insertIntegration } from '../_tests/fixtures'
import { compileHog } from '../templates/compiler'
import { HogFunctionInvocationGlobals, HogFunctionType } from '../types'
+import { classifyHogError } from '../utils/hog-error-classification'
import { HogInputsService, formatHogInput, formatLiquidInput, getAppIdentifierForPush } from './hog-inputs.service'
import { RecipientTokensService } from './messaging/recipient-tokens.service'
@@ -317,12 +318,28 @@ describe('Hog Inputs', () => {
expect(inputs.is_enabled).toBe(false)
})
- it('should not load integrations from a different team', async () => {
- hogFunction.team_id = 100
+ it.each([
+ ['was deleted', (): void => void (hogFunction.inputs!.oauth = { value: 99999999 })],
+ ['belongs to a different team', (): void => void (hogFunction.team_id = 100)],
+ ])('fails instead of running without the integration when it %s', async (_name, setup) => {
+ setup()
- const inputs = await hogInputsService.buildInputs(hogFunction, globals)
+ const error = await hogInputsService.buildInputs(hogFunction, globals).catch((e) => e)
+
+ expect(error.message).toContain("The integration for input 'oauth' no longer exists.")
+ // Anything but `config` parks the event and blocks DLQ replay on a failure no replay can fix.
+ expect(classifyHogError(error, { runtimeContract: 'any' })).toBe('config')
+ })
+
+ it('ignores a deleted integration on a mapping this invocation does not use', async () => {
+ hogFunction.mappings = [
+ { inputs: { slack: { value: 99999999 } }, inputs_schema: [{ key: 'slack', type: 'integration' }] },
+ ]
- expect(inputs.oauth).toMatchInlineSnapshot(`null`)
+ await expect(hogInputsService.buildInputs(hogFunction, globals)).resolves.toBeDefined()
+ await expect(
+ hogInputsService.buildInputs(hogFunction, globals, hogFunction.mappings[0].inputs ?? {})
+ ).rejects.toThrow("The integration for input 'slack' no longer exists.")
})
it('should not load a posthog connection', async () => {
@@ -380,7 +397,7 @@ describe('Hog Inputs', () => {
expect(inputs.email.design).toBeUndefined()
})
- it('resolves push subscription inputs without a valid integration', async () => {
+ it('resolves push subscription inputs without a push integration', async () => {
const hogFunction = createHogFunction({
id: 'hog-function-1',
team_id: team.id,
@@ -388,7 +405,7 @@ describe('Hog Inputs', () => {
enabled: true,
type: 'destination',
inputs: {
- push_provider: { value: 999 },
+ push_provider: { value: integrationId1 },
push_subscription: { value: 'user-123' },
},
inputs_schema: [
diff --git a/nodejs/src/cdp/services/hog-inputs.service.ts b/nodejs/src/cdp/services/hog-inputs.service.ts
index 943d3205ca75..8d64234da2dc 100644
--- a/nodejs/src/cdp/services/hog-inputs.service.ts
+++ b/nodejs/src/cdp/services/hog-inputs.service.ts
@@ -6,7 +6,7 @@ import { logger } from '~/common/utils/logger'
import { HogFunctionInvocationGlobals, HogFunctionInvocationGlobalsWithInputs, HogFunctionType } from '../types'
import { EncryptedFields } from '../utils/encryption-utils'
-import { isHogVMErrorKind, withBytecodeContract } from '../utils/hog-error-classification'
+import { HogConfigurationError, isHogVMErrorKind, withBytecodeContract } from '../utils/hog-error-classification'
import { execHog } from '../utils/hog-exec'
import { LiquidRenderBudget, LiquidRenderer } from '../utils/liquid'
import { getDevicePushSubscriptionToken } from '../utils/push-subscription-utils'
@@ -34,14 +34,17 @@ export class HogInputsService {
...globals,
inputs: {},
}
- const inputs: HogFunctionType['inputs'] = {
+ const ownInputs: HogFunctionType['inputs'] = {
// Include the inputs from the hog function
...hogFunction.inputs,
...hogFunction.encrypted_inputs,
// Plus any additional inputs
...additionalInputs,
+ }
+ const inputs: HogFunctionType['inputs'] = {
+ ...ownInputs,
// and decode any integration inputs (and push subscription inputs when newGlobals provided)
- ...(await this.loadIntegrationInputs(hogFunction, newGlobals)),
+ ...(await this.loadIntegrationInputs(hogFunction, newGlobals, { throwIfMissingIn: ownInputs })),
}
// One budget for the whole invocation, so many small liquid leaves cannot add up to a stall.
@@ -169,7 +172,9 @@ export class HogInputsService {
public async loadIntegrationInputs(
hogFunction: HogFunctionType,
- newGlobals?: HogFunctionInvocationGlobalsWithInputs
+ newGlobals?: HogFunctionInvocationGlobalsWithInputs,
+ // Loading covers every mapping, so only the inputs this invocation uses may fail it.
+ options?: { throwIfMissingIn?: HogFunctionType['inputs'] }
): Promise<Record<string, { value: Record<string, any> | Record<string, any>[] | null }>> {
// Single integration inputs map a key to one id; integration_multi maps a key to a list of ids.
const singleInputsToLoad: Record<string, number> = {}
@@ -237,6 +242,13 @@ export class HogInputsService {
}
Object.entries(singleInputsToLoad).forEach(([key, id]) => {
+ // Without this the template runs with an empty connection, and a URL built from it fails far from the cause.
+ const isUsed = options?.throwIfMissingIn?.[key]?.value === id
+ if (isUsed && (!integrations[id] || integrations[id].team_id !== hogFunction.team_id)) {
+ throw new HogConfigurationError(
+ `The integration for input '${key}' no longer exists. It may have been deleted. Select a connected integration for this input.`
+ )
+ }
returnInputs[key] = { value: resolveIntegration(id) }
})
diff --git a/nodejs/src/cdp/utils/hog-error-classification.ts b/nodejs/src/cdp/utils/hog-error-classification.ts
index d25d7ed396a3..893098901ed3 100644
--- a/nodejs/src/cdp/utils/hog-error-classification.ts
+++ b/nodejs/src/cdp/utils/hog-error-classification.ts
@@ -13,10 +13,14 @@ import { HogVMErrorKind, HogVMException } from '@posthog/hogvm'
* what exists. Ours to fix.
* - `limit`: the program ran out of time, memory or stack. Replay would run out again, so it is the
* owner's to fix. Many functions hitting it at once is a different story, and the label shows that.
+ * - `config`: the function points at something the owner removed, such as a deleted integration.
+ * The owner has to fix the function; replaying the event cannot.
* - `platform`: a JavaScript error the VM let through, or something that is not an error at all.
* Ours to look at.
*/
-export type HogErrorClass = 'data' | 'legacy' | 'drift' | 'bug' | 'limit' | 'platform'
+export type HogErrorClass = 'data' | 'legacy' | 'drift' | 'bug' | 'limit' | 'config' | 'platform'
+
+export class HogConfigurationError extends Error {}
export type HogErrorContract = {
/** The stamp on the bytecode that ran, from `filters.bytecode_contract`. Absent on older bytecode. */
@@ -73,6 +77,9 @@ export function bytecodeContractOf(error: unknown): string | undefined {
}
export function classifyHogError(error: unknown, contract: HogErrorContract): HogErrorClass {
+ if (error instanceof HogConfigurationError) {
+ return 'config'
+ }
const vmError = findHogVMException(error)
if (!vmError) {
return 'platform'
diff --git a/nodejs/src/cdp/utils/invocation-utils.ts b/nodejs/src/cdp/utils/invocation-utils.ts
index 1d980536e589..09ca1cf6363b 100644
--- a/nodejs/src/cdp/utils/invocation-utils.ts
+++ b/nodejs/src/cdp/utils/invocation-utils.ts
@@ -1,4 +1,5 @@
// NOTE: PostIngestionEvent is our context event - it should never be sent directly to an output, but rather transformed into a lightweight schema
+import { DateTime } from 'luxon'
import { Counter } from 'prom-client'
import { UUIDT } from '~/common/utils/utils'
@@ -244,6 +245,26 @@ export function cloneInvocation<T extends CyclotronJobInvocation>(
}
}
+export function createInputsFailureResult(
+ hogFunction: HogFunctionType,
+ globals: HogFunctionInvocationGlobals,
+ error: Error,
+ invocationId?: string
+): CyclotronJobInvocationResult<CyclotronJobInvocationHogFunction> {
+ const invocation = createInvocation({ ...globals, inputs: {} }, hogFunction)
+ if (invocationId) {
+ invocation.id = invocationId
+ }
+ return createInvocationResult<CyclotronJobInvocationHogFunction>(
+ invocation,
+ {},
+ {
+ error: error.message,
+ logs: [{ level: 'error', timestamp: DateTime.now(), message: `Error building inputs: ${error.message}` }],
+ }
+ )
+}
+
/**
* Safely creates an invocation result from an invocation, cloning it and resetting the relevant queue parameters
*/
diff --git a/nodejs/tests/fixtures/hog-bytecode/bc21c6c364867bb5572661e7082903b0274b065429abef2e9ec94b2442fcf92e.json b/nodejs/tests/fixtures/hog-bytecode/bc21c6c364867bb5572661e7082903b0274b065429abef2e9ec94b2442fcf92e.json
new file mode 100644
index 000000000000..695f35be62a8
--- /dev/null
+++ b/nodejs/tests/fixtures/hog-bytecode/bc21c6c364867bb5572661e7082903b0274b065429abef2e9ec94b2442fcf92e.json
@@ -0,0 +1 @@
+["_H",1,32,"event",1,1,36,0,32,"properties",45,32,"transformed",29,46,36,0,38,35]
diff --git a/products/workflows/frontend/Workflows/workflowLogic.ts b/products/workflows/frontend/Workflows/workflowLogic.ts
index 9c0fd29b853a..6ec1d55053d1 100644
--- a/products/workflows/frontend/Workflows/workflowLogic.ts
+++ b/products/workflows/frontend/Workflows/workflowLogic.ts
@@ -12,6 +12,7 @@ import { CyclotronJobInputsValidation } from 'lib/components/CyclotronJob/Cyclot
import { tryShowMCPHint } from 'lib/components/MCPHint/mcpHintLogic'
import { SetupTaskId, globalSetupLogic } from 'lib/components/ProductSetup'
import { dayjs } from 'lib/dayjs'
+import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { publicWebhooksHostOrigin } from 'lib/utils/apiHost'
import { LiquidRenderer } from 'lib/utils/liquid'
@@ -23,7 +24,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
-import { AccessControlLevel, HogFunctionTemplateType } from '~/types'
+import { AccessControlLevel, HogFunctionTemplateType, IntegrationType } from '~/types'
import { resourceEditedLogic } from 'products/notifications/frontend/resourceEditedLogic'
import { hogFlowsResumeEmailSending } from 'products/workflows/frontend/generated/api'
@@ -237,6 +238,7 @@ function omitWorkflowContent(workflow: HogFlow): Partial<HogFlow> {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface workflowLogicValues {
+ integrations: IntegrationType[] | null // integrationsLogic
currentProjectId: number | null // projectLogic
user: UserType | null // userLogic
actionValidationErrorsById: Record<string, HogFlowActionValidationResult | null>
@@ -2910,7 +2912,8 @@ export interface workflowLogicMeta {
hogFunctionTemplatesById: Record<string, HogFunctionTemplateType>,
hogFunctionTemplatesByIdLoading: boolean,
scheduleStartsAt: string | null,
- saveAttemptedActionIds: string[] | null
+ saveAttemptedActionIds: string[] | null,
+ integrations: IntegrationType[] | null
) => Record<string, HogFlowActionValidationResult | null>
workflowHasActionErrors: (
workflow: HogFlow,
@@ -3109,7 +3112,7 @@ export const workflowLogic = kea<workflowLogicType>([
`workflow-${props.id || 'new'}-${props.templateId || 'default'}-${props.editTemplateId || 'default'}-${props.triggerPrefill || 'default'}-${props.emailPrefill || 'default'}`
),
connect(() => ({
- values: [userLogic, ['user'], projectLogic, ['currentProjectId']],
+ values: [userLogic, ['user'], projectLogic, ['currentProjectId'], integrationsLogic, ['integrations']],
actions: [workflowsLogic, ['archiveWorkflow'], resourceEditedLogic, ['resourceEdited']],
})),
actions({
@@ -3661,13 +3664,15 @@ export const workflowLogic = kea<workflowLogicType>([
s.hogFunctionTemplatesByIdLoading,
s.scheduleStartsAt,
s.saveAttemptedActionIds,
+ s.integrations,
],
(
workflow: HogFlow,
hogFunctionTemplatesById: Record<string, HogFunctionTemplateType>,
hogFunctionTemplatesByIdLoading: boolean,
scheduleStartsAt: string | null,
- saveAttemptedActionIds: string[] | null
+ saveAttemptedActionIds: string[] | null,
+ integrations: IntegrationType[] | null
): Record<string, HogFlowActionValidationResult | null> => {
// Warehouse- and Slack-triggered workflows are person-less ("row-scoped").
// Person-dependent step types make no sense without a person, so we block them at
@@ -3770,7 +3775,8 @@ export const workflowLogic = kea<workflowLogicType>([
} else {
const configValidation = CyclotronJobInputsValidation.validate(
action.config.inputs,
- template.inputs_schema ?? []
+ template.inputs_schema ?? [],
+ integrations
)
// Merge so the type-specific block above (e.g. function_email's
// stricter `from` check) is not clobbered by the generic validator.