AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
fix(flows): migrate oracle-database 0.1.11/0.1.12 to 0.1.15 (flow schema v28) (#15957)
Ahmad Tashc2075db0b9bf
diff --git a/brain/knowledge/connections-auth/app-connections.md b/brain/knowledge/connections-auth/app-connections.mdindex ac051b335e6..910e37386e2 100644--- a/brain/knowledge/connections-auth/app-connections.md+++ b/brain/knowledge/connections-auth/app-connections.md@@ -47,3 +47,4 @@ Paths verified 2026-07-17.## Gotchas- **`needRefresh` looks the piece up by `connection.pieceVersion`, so a CUSTOM_AUTH connection whose stored version is no longer served fails as `ConnectionNotFound`, not as a version error.** Any 404 from `GET /v1/worker/app-connections/:externalId` is mapped by the engine to "connection not found", which points debugging at credentials. On a dev instance this happens the moment a dev piece's version is bumped; in production it would need a published version to disappear from the registry. The lookup result is cached per piece version in `pieceRefreshSupportCache`.+- **`status: ACTIVE` only means the credentials validated when the connection was saved. Runs never re-check it.** After an out-of-band password rotation (e.g. a customer vault like CyberArk rotating a service account), the connection still shows as connected while every step fails with the provider's own auth error. **Recheck** (`POST /v1/app-connections/:id/revalidate`) re-runs the piece's `validate` and flips it to `ERROR`. Custom-auth props reach the piece unchanged on both the save and run paths. Secret-manager resolution only touches `{{<id>|ap_sep_v1|<path>}}` strings. So a provider auth error (Oracle `ORA-01017`) means the provider rejected exactly what was typed or stored. Reproduced on 0.91.0 with oracle-database 0.1.15, 2026-09-29.diff --git a/brain/knowledge/pieces-engine/pieces.md b/brain/knowledge/pieces-engine/pieces.mdindex bdc06bfe9cd..bf10362cf25 100644--- a/brain/knowledge/pieces-engine/pieces.md+++ b/brain/knowledge/pieces-engine/pieces.md@@ -55,6 +55,7 @@ The metadata catalog of automation integrations ("pieces") — each a named inte- **Deleting a piece's source is safe for pinned flows; deleting the server route that source calls is not.** A step pinned to an older piece version runs that version's *published bundle*, which carries its own compiled copy of everything it imports — so removing a file from the repo cannot break it, and a refactor may delete what it replaces in the same PR. A server API route those older bundles call at run time is the opposite: it has live callers until a flow migration has moved every pinned step forward, and closing it early fails them with nothing in the repo to explain why. So the two halves of "remove the old path" sequence differently — source with the change, route after the migration promotes. One exception on the source side: anything re-exported from the piece's `index.ts` is public surface, so check the breaking-change rules before removing it.- **`piece-upgrade-register.json` has two consumers, not one.** The upgrade/downgrade dialog is the obvious one; the other is `migrate-v23`, which sits in the flow migration chain — so the register rewrites `pieceVersion` on every flow-version read, not only when someone clicks something. That makes regenerating it a live change to running flows. It also means a migration that pins a version can be undone by a later one in the same `apply()` pass: `migrate-v22` hands off at schemaVersion 23 and `migrate-v23`'s `targetSchemaVersion` is 23, so both run in one pass. Harmless only because the register's highest AI entry is `0.4.4` — add entries and v23 starts upgrading what v22 just pinned. **Pin versions in a migration of your own, appended last; leave the register alone.**+- **A register `target` must be a version that actually runs, not just the first bundle-era one.** Every pre-cutoff `oracle-database` version (0.0.1–0.1.10) targeted 0.1.11, whose bundle shipped without its forked `oracle-runner.js`, so upgrading a self-hosted instance to 0.89 or later silently moved working Oracle steps onto a build that fails every run with `Oracle runner exited (code 1)` (reported by a self-hosted customer, 2026-09-29). Fixed by retargeting to 0.1.15 and `migrate-v27`, which also repairs steps the bad target already rewrote. The CDN's retro-bundled 0.1.9–0.1.10 have the same hole (no runner, no `oracledb` dependency), so `AP_USE_CDN_FOR_BUNDLES=true` breaks those versions too.- **`ctx.files.write()` returns a URL served as `application/octet-stream`, so a vendor that sniffs Content-Type will reject it.** The signed read URL (`v1/files/{id}?token=`) carries no file extension, and on S3/R2 storage it 307-redirects to presigned storage where the real filename rides only on `response-content-disposition`. WhatsScale's `/make/prepareFile` refuses it outright — `"URL did not return an image, video, document, or audio file. Got content-type: application/octet-stream" (400)` — unless an explicit `mediaType` is passed alongside the URL. Any piece that hands an AP-hosted file URL to a third party has to tell that API the media type out-of-band; do not assume the URL is self-describing. Verified live 2026-08-24 on the WhatsScale piece: identical URL, 400 without `mediaType`, delivered correctly with it.- **On Cloud edition the catalog lives in the database and only the sync fills it, so `ap-dev up cloud --fresh` with `AP_PIECES_SYNC_MODE=NONE` boots with two pieces and no error.** `pieceSyncService` (`piece-sync-service.ts`) pulls the official catalog from cloud.activepieces.com at startup and hourly, but returns early with `Piece sync service is disabled` when the mode is anything but `OFFICIAL_AUTO`, the default. A stale `NONE` left in `.env.dev` from a CE session survives the wipe because the dev script only rewrites its own keys, and `AP_DEV_PIECES` is ignored on cloud, so the picker is simply empty. Confirm with `GET /api/v1/flags` (`PIECES_SYNC_MODE`) and `SELECT count(*) FROM piece_metadata`, then `ap-dev up cloud AP_PIECES_SYNC_MODE=OFFICIAL_AUTO` without `--fresh`. Seen 2026-09-23 while testing the AI Router on a fresh cloud dev instance.diff --git a/packages/core/execution/src/lib/flows/flow-version.ts b/packages/core/execution/src/lib/flows/flow-version.tsindex a76b8168301..97d4d0400fe 100755--- a/packages/core/execution/src/lib/flows/flow-version.ts+++ b/packages/core/execution/src/lib/flows/flow-version.ts@@ -4,7 +4,7 @@ import { UserWithMetaInformation } from '@activepieces/core-piece-types'import { Note } from './note'import { FlowTrigger } from './triggers/trigger'-export const LATEST_FLOW_SCHEMA_VERSION = '27'+export const LATEST_FLOW_SCHEMA_VERSION = '28'export enum FlowVersionState {LOCKED = 'LOCKED',diff --git a/packages/server/api/src/app/flows/flow-version/migrations/index.ts b/packages/server/api/src/app/flows/flow-version/migrations/index.tsindex a97e43d6476..11a0b8d8cbb 100644--- a/packages/server/api/src/app/flows/flow-version/migrations/index.ts+++ b/packages/server/api/src/app/flows/flow-version/migrations/index.ts@@ -21,6 +21,7 @@ import { migrateV23UpgradePieceVersions } from './migrate-v23-upgrade-piece-versimport { migrateV24OpenaiPieceVersion } from './migrate-v24-openai-piece-version'import { migrateV25HttpPieceVersion } from './migrate-v25-http-piece-version'import { migrateV26AiPieceCostBilling } from './migrate-v26-ai-piece-cost-billing'+import { migrateV27OracleDatabasePieceVersion } from './migrate-v27-oracle-database-piece-version'import { migrateAgentPieceV3 } from './migrate-v3-agent-piece'import { migrateAgentPieceV4 } from './migrate-v4-agent-piece'import { migrateHttpToWebhookV5 } from './migrate-v5-http-to-webhook'@@ -68,6 +69,7 @@ const migrations: Migration[] = [migrateV24OpenaiPieceVersion,migrateV25HttpPieceVersion,migrateV26AiPieceCostBilling,+ migrateV27OracleDatabasePieceVersion,] as constexport const flowMigrations = {diff --git a/packages/server/api/src/app/flows/flow-version/migrations/migrate-v27-oracle-database-piece-version.ts b/packages/server/api/src/app/flows/flow-version/migrations/migrate-v27-oracle-database-piece-version.tsnew file mode 100644index 00000000000..8c678c73642--- /dev/null+++ b/packages/server/api/src/app/flows/flow-version/migrations/migrate-v27-oracle-database-piece-version.ts@@ -0,0 +1,31 @@+import { FlowActionType, flowStructureUtil, FlowTriggerType, FlowVersion } from '@activepieces/shared'+import { Migration } from '.'++export const migrateV27OracleDatabasePieceVersion: Migration = {+ targetSchemaVersion: '27',+ migrate: async (flowVersion: FlowVersion): Promise<FlowVersion> => {+ const newVersion = flowStructureUtil.transferFlow(flowVersion, (step) => {+ if (step.type !== FlowActionType.PIECE && step.type !== FlowTriggerType.PIECE) {+ return step+ }+ if (step.settings.pieceName !== ORACLE_DATABASE_PIECE_NAME || !BROKEN_PIECE_VERSIONS.has(step.settings.pieceVersion)) {+ return step+ }+ return {+ ...step,+ settings: {+ ...step.settings,+ pieceVersion: FIXED_PIECE_VERSION,+ },+ }+ })+ return { ...newVersion, schemaVersion: '28' }+ },+}++const ORACLE_DATABASE_PIECE_NAME = '@activepieces/piece-oracle-database'+const BROKEN_PIECE_VERSIONS = new Set([+ '0.1.11',+ '0.1.12',+])+const FIXED_PIECE_VERSION = '0.1.15'diff --git a/packages/server/api/src/assets/piece-upgrade-register.json b/packages/server/api/src/assets/piece-upgrade-register.jsonindex 5fb5395438b..fd3ccfd99cf 100644--- a/packages/server/api/src/assets/piece-upgrade-register.json+++ b/packages/server/api/src/assets/piece-upgrade-register.json@@ -6505,21 +6505,21 @@"0.1.5": {"target": "0.1.6"}},"@activepieces/piece-oracle-database": {- "0.0.1": {"target": "0.1.11"},- "0.0.2": {"target": "0.1.11"},- "0.0.3": {"target": "0.1.11"},- "0.0.4": {"target": "0.1.11"},- "0.1.0": {"target": "0.1.11"},- "0.1.1": {"target": "0.1.11"},- "0.1.2": {"target": "0.1.11"},- "0.1.3": {"target": "0.1.11"},- "0.1.4": {"target": "0.1.11"},- "0.1.5": {"target": "0.1.11"},- "0.1.6": {"target": "0.1.11"},- "0.1.7": {"target": "0.1.11"},- "0.1.8": {"target": "0.1.11"},- "0.1.9": {"target": "0.1.11"},- "0.1.10": {"target": "0.1.11"}+ "0.0.1": {"target": "0.1.15"},+ "0.0.2": {"target": "0.1.15"},+ "0.0.3": {"target": "0.1.15"},+ "0.0.4": {"target": "0.1.15"},+ "0.1.0": {"target": "0.1.15"},+ "0.1.1": {"target": "0.1.15"},+ "0.1.2": {"target": "0.1.15"},+ "0.1.3": {"target": "0.1.15"},+ "0.1.4": {"target": "0.1.15"},+ "0.1.5": {"target": "0.1.15"},+ "0.1.6": {"target": "0.1.15"},+ "0.1.7": {"target": "0.1.15"},+ "0.1.8": {"target": "0.1.15"},+ "0.1.9": {"target": "0.1.15"},+ "0.1.10": {"target": "0.1.15"}},"@activepieces/piece-oracle-fusion-cloud-erp": {"0.0.1": {"target": "0.0.7"},diff --git a/packages/server/api/test/unit/app/flows/flow-version/migrate-v27-oracle-database-piece-version.test.ts b/packages/server/api/test/unit/app/flows/flow-version/migrate-v27-oracle-database-piece-version.test.tsnew file mode 100644index 00000000000..ab4d58e34a7--- /dev/null+++ b/packages/server/api/test/unit/app/flows/flow-version/migrate-v27-oracle-database-piece-version.test.ts@@ -0,0 +1,124 @@+import { readFileSync } from 'node:fs'+import path from 'node:path'+import {+ FlowActionType,+ flowStructureUtil,+ FlowTriggerType,+ FlowVersionState,+} from '@activepieces/shared'+import type { FlowAction, FlowTrigger, FlowVersion } from '@activepieces/shared'+import { describe, expect, it } from 'vitest'+import { migrateV27OracleDatabasePieceVersion } from '../../../../../src/app/flows/flow-version/migrations/migrate-v27-oracle-database-piece-version'++function makeActionStep({ name, pieceName, pieceVersion, nextAction }: { name: string, pieceName: string, pieceVersion: string, nextAction?: FlowAction }): FlowAction {+ return {+ name,+ valid: true,+ displayName: name,+ type: FlowActionType.PIECE,+ settings: {+ pieceName,+ pieceVersion,+ actionName: 'run_custom_sql',+ input: {},+ propertySettings: {},+ },+ nextAction,+ }+}++function makeTrigger({ pieceVersion, nextAction }: { pieceVersion: string, nextAction?: FlowAction }): FlowTrigger {+ return {+ name: 'trigger',+ valid: true,+ displayName: 'New Row',+ type: FlowTriggerType.PIECE,+ settings: {+ pieceName: ORACLE_PIECE_NAME,+ pieceVersion,+ triggerName: 'new_row',+ input: {},+ propertySettings: {},+ },+ nextAction,+ }+}++function makeFlowVersion({ triggerVersion }: { triggerVersion: string }): FlowVersion {+ const steps = [+ { name: 'oracle_first_broken', pieceName: ORACLE_PIECE_NAME, pieceVersion: '0.1.11' },+ { name: 'oracle_second_broken', pieceName: ORACLE_PIECE_NAME, pieceVersion: '0.1.12' },+ { name: 'oracle_before_broken', pieceName: ORACLE_PIECE_NAME, pieceVersion: '0.1.10' },+ { name: 'oracle_fixed', pieceName: ORACLE_PIECE_NAME, pieceVersion: '0.1.13' },+ { name: 'oracle_latest', pieceName: ORACLE_PIECE_NAME, pieceVersion: '0.1.15' },+ { name: 'other_piece', pieceName: '@activepieces/piece-slack', pieceVersion: '0.1.11' },+ ]+ const chain = steps.reduceRight<FlowAction | undefined>((nextAction, step) => makeActionStep({ ...step, nextAction }), undefined)+ return {+ id: 'fv-1',+ created: '2024-01-01T00:00:00Z',+ updated: '2024-01-01T00:00:00Z',+ flowId: 'flow-1',+ displayName: 'Test Flow',+ trigger: makeTrigger({ pieceVersion: triggerVersion, nextAction: chain }),+ updatedBy: null,+ valid: true,+ schemaVersion: '27',+ agentIds: [],+ state: FlowVersionState.DRAFT,+ connectionIds: [],+ backupFiles: null,+ notes: [],+ }+}++function findStepVersion({ flowVersion, name }: { flowVersion: FlowVersion, name: string }): string | undefined {+ const step = flowStructureUtil.getAllSteps(flowVersion.trigger).find((s) => s.name === name)+ if (step?.type !== FlowActionType.PIECE && step?.type !== FlowTriggerType.PIECE) {+ return undefined+ }+ return step.settings.pieceVersion+}++describe('migrateV27OracleDatabasePieceVersion', () => {+ it.each([+ ['oracle_first_broken'],+ ['oracle_second_broken'],+ ])('moves an oracle step pinned to a build without the forked runner to 0.1.15 (%s)', async (stepName) => {+ const result = await migrateV27OracleDatabasePieceVersion.migrate(makeFlowVersion({ triggerVersion: '0.1.13' }))+ expect(findStepVersion({ flowVersion: result, name: stepName })).toBe('0.1.15')+ })++ it('moves an oracle trigger pinned to a broken build to 0.1.15', async () => {+ const result = await migrateV27OracleDatabasePieceVersion.migrate(makeFlowVersion({ triggerVersion: '0.1.11' }))+ expect(findStepVersion({ flowVersion: result, name: 'trigger' })).toBe('0.1.15')+ })++ it.each([+ ['oracle_before_broken', '0.1.10'],+ ['oracle_fixed', '0.1.13'],+ ['oracle_latest', '0.1.15'],+ ])('leaves oracle steps on working builds untouched (%s)', async (stepName, version) => {+ const result = await migrateV27OracleDatabasePieceVersion.migrate(makeFlowVersion({ triggerVersion: '0.1.13' }))+ expect(findStepVersion({ flowVersion: result, name: stepName })).toBe(version)+ })++ it('leaves other pieces on the same version untouched', async () => {+ const result = await migrateV27OracleDatabasePieceVersion.migrate(makeFlowVersion({ triggerVersion: '0.1.13' }))+ expect(findStepVersion({ flowVersion: result, name: 'other_piece' })).toBe('0.1.11')+ })++ it('bumps the schema version to 28', async () => {+ const result = await migrateV27OracleDatabasePieceVersion.migrate(makeFlowVersion({ triggerVersion: '0.1.13' }))+ expect(result.schemaVersion).toBe('28')+ })++ it('never lets the v23 upgrade register target an oracle build without the forked runner', () => {+ const register: { pieces: Record<string, Record<string, { target: string }>> } = JSON.parse(readFileSync(path.resolve('packages/server/api/src/assets/piece-upgrade-register.json'), 'utf-8'))+ const targets = Object.values(register.pieces[ORACLE_PIECE_NAME] ?? {}).map((entry) => entry.target)+ expect(targets.length).toBeGreaterThan(0)+ expect(targets.filter((target) => ['0.1.11', '0.1.12'].includes(target))).toEqual([])+ })+})++const ORACLE_PIECE_NAME = '@activepieces/piece-oracle-database'