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.

feat(batch-exports): require an integration for S3 exports in the UI (#86453)

Rossaff81fcb181e
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index bff1a1285dc6..1b0cb88aaef1 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5756,10 +5756,6 @@ snapshots:
hash: v1.k794b7964.bd6c771412a0a94b18f4ccf9e1d49b5618dd5832f213db69668f4669ec7368fb.wYOVOvzHJarYOR5JuHFQcyRL5SXIUqTU2X5RITySkng
scenes-app-batchexports--new-s-3-compatible-export--light:
hash: v1.k794b7964.67df45858aeb4fcf46af4f7afabc683cec81be3442b2c561b6af13401b3200a2._8_wr0216yWo9Rn0UqS88sGH35FBPLD-jFMdhw5z_Mk
- scenes-app-batchexports--new-s-3-export--dark:
- hash: v1.k794b7964.f46d394738974eb3d02b849560277a19768798eb28f4d0db8ace2b7ed995f6c0.vtSRWfK4ELlej9rcHE2Gu4p_YqNwmszdSKA-ENaoROQ
- scenes-app-batchexports--new-s-3-export--light:
- hash: v1.k794b7964.0b39adf828caa2776a8a90f798157511d7db9162c7f371f2805af11c646eafa0.pfiWERvy7Xz3-xZHmshfXGWOqGwynxM8mDkFB2Moslk
scenes-app-batchexports--new-snowflake-export--dark:
hash: v1.k794b7964.075b8aa4181551b8bee5dceb4982f9b97877b50ead700a111e2667dc3812bdb7.M8WKd7N1oqgqtdmMI9zCDmHrgDdfnDof2FWsg1r3LlY
scenes-app-batchexports--new-snowflake-export--light:
diff --git a/frontend/src/scenes/data-pipelines/__mocks__/batchExports.json b/frontend/src/scenes/data-pipelines/__mocks__/batchExports.json
index 1e1be726c89b..ba74597cda26 100644
--- a/frontend/src/scenes/data-pipelines/__mocks__/batchExports.json
+++ b/frontend/src/scenes/data-pipelines/__mocks__/batchExports.json
@@ -315,7 +315,7 @@
"team_id": 2,
"name": "S3 Export",
"destination": {
- "type": "S3",
+ "type": "AwsS3",
"config": {
"prefix": "us-cloud/",
"region": "us-east-1",
@@ -469,7 +469,7 @@
"team_id": 2,
"name": "Test S3 Export",
"destination": {
- "type": "S3",
+ "type": "AwsS3",
"config": {
"prefix": "posthog-events/",
"region": "us-east-1",
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/BatchExportIcon.tsx b/frontend/src/scenes/data-pipelines/batch-exports/BatchExportIcon.tsx
index fd08128906d8..dd4af91566a7 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/BatchExportIcon.tsx
+++ b/frontend/src/scenes/data-pipelines/batch-exports/BatchExportIcon.tsx
@@ -13,7 +13,7 @@ import IconS3Compatible from 'public/services/s3-compatible.png'
import IconSnowflake from 'public/services/snowflake.png'
export function getBatchExportDocsUrl(service: BatchExportService['type']): string {
- // The whole S3 family (legacy S3, AwsS3, S3Compatible) shares the one S3 docs page.
+ // AwsS3 and S3Compatible share the one S3 docs page.
const slug = service === 'AwsS3' || service === 'S3Compatible' ? 's3' : service.toLowerCase()
return `https://posthog.com/docs/cdp/batch-exports/${slug}`
}
@@ -23,7 +23,6 @@ export const BATCH_EXPORT_ICON_MAP: Record<BatchExportService['type'], string> =
BigQuery: IconBigQuery,
Postgres: IconPostgres,
Redshift: IconRedshift,
- S3: IconS3,
AwsS3: IconS3,
S3Compatible: IconS3Compatible,
Snowflake: IconSnowflake,
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/BatchExportScene.stories.tsx b/frontend/src/scenes/data-pipelines/batch-exports/BatchExportScene.stories.tsx
index 2e456ae9f194..7730b9920aa0 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/BatchExportScene.stories.tsx
+++ b/frontend/src/scenes/data-pipelines/batch-exports/BatchExportScene.stories.tsx
@@ -58,13 +58,6 @@ export const NewS3CompatibleExport: Story = {
},
}
-// Legacy `S3` type — hidden from the picker but still renders for not-yet-migrated rows.
-export const NewS3Export: Story = {
- parameters: {
- pageUrl: urls.batchExportNew('s3'),
- },
-}
-
export const NewSnowflakeExport: Story = {
parameters: {
pageUrl: urls.batchExportNew('snowflake'),
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/batchExportBackfillModalLogic.test.ts b/frontend/src/scenes/data-pipelines/batch-exports/batchExportBackfillModalLogic.test.ts
index 1e3bc5d5ab20..2d0914e344d7 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/batchExportBackfillModalLogic.test.ts
+++ b/frontend/src/scenes/data-pipelines/batch-exports/batchExportBackfillModalLogic.test.ts
@@ -25,22 +25,19 @@ const MOCK_BATCH_EXPORT_CONFIG: BatchExportConfiguration = {
team_id: 997,
name: 'Test Export',
destination: {
- type: 'S3',
+ type: 'AwsS3',
+ integration: 31,
config: {
bucket_name: 'test-bucket',
region: 'us-east-1',
prefix: 'events/',
- aws_access_key_id: 'AKIAIOSFODNN7EXAMPLE',
- aws_secret_access_key: 'secret',
exclude_events: [],
include_events: [],
compression: 'gzip',
encryption: null,
kms_key_id: null,
- endpoint_url: null,
file_format: 'Parquet',
max_file_size_mb: null,
- use_virtual_style_addressing: false,
},
},
interval: 'hour',
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/batchExportBackfillsLogic.test.ts b/frontend/src/scenes/data-pipelines/batch-exports/batchExportBackfillsLogic.test.ts
index c45141f62364..22e7be87ad49 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/batchExportBackfillsLogic.test.ts
+++ b/frontend/src/scenes/data-pipelines/batch-exports/batchExportBackfillsLogic.test.ts
@@ -35,22 +35,19 @@ const MOCK_BATCH_EXPORT_CONFIG: BatchExportConfiguration = {
team_id: 997,
name: 'Test Export',
destination: {
- type: 'S3',
+ type: 'AwsS3',
+ integration: 31,
config: {
bucket_name: 'test-bucket',
region: 'us-east-1',
prefix: 'events/',
- aws_access_key_id: 'AKIAIOSFODNN7EXAMPLE',
- aws_secret_access_key: 'secret',
exclude_events: [],
include_events: [],
compression: 'gzip',
encryption: null,
kms_key_id: null,
- endpoint_url: null,
file_format: 'Parquet',
max_file_size_mb: null,
- use_virtual_style_addressing: false,
},
},
interval: 'hour',
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/batchExportConfigFormLogic.test.ts b/frontend/src/scenes/data-pipelines/batch-exports/batchExportConfigFormLogic.test.ts
index 5545f01dcf1d..215ebc82c0f1 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/batchExportConfigFormLogic.test.ts
+++ b/frontend/src/scenes/data-pipelines/batch-exports/batchExportConfigFormLogic.test.ts
@@ -39,56 +39,45 @@ function fixture<T extends BatchExportConfiguration['destination']>(
}
}
-const S3_BATCH_EXPORT = fixture('test-s3-id', 'S3 Export', {
- type: 'S3',
- config: {
- bucket_name: 'test-bucket',
- region: 'us-east-1',
- prefix: 'posthog-events/',
- aws_access_key_id: 'AKIAIOSFODNN7EXAMPLE',
- aws_secret_access_key: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
- exclude_events: [],
- include_events: [],
- compression: 'gzip',
- encryption: null,
- kms_key_id: null,
- endpoint_url: null,
- file_format: 'Parquet',
- max_file_size_mb: null,
- use_virtual_style_addressing: false,
- },
-})
+// AwsS3 and S3Compatible exports are integration-backed: credentials, and the S3-compatible
+// endpoint URL, live on the integration rather than in the config.
+const AWS_S3_CONFIG = {
+ bucket_name: 'test-bucket',
+ region: 'us-east-1',
+ prefix: 'posthog-events/',
+ exclude_events: [],
+ include_events: [],
+ compression: 'zstd',
+ encryption: null,
+ kms_key_id: null,
+ file_format: 'Parquet',
+ max_file_size_mb: null,
+}
const AWS_S3_BATCH_EXPORT = fixture('test-aws-s3-id', 'AWS S3 Export', {
type: 'AwsS3',
- config: {
- bucket_name: 'test-bucket',
- region: 'us-east-1',
- prefix: 'posthog-events/',
- aws_access_key_id: 'AKIAIOSFODNN7EXAMPLE',
- aws_secret_access_key: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
- exclude_events: [],
- include_events: [],
- compression: 'zstd',
- encryption: null,
- kms_key_id: null,
- file_format: 'Parquet',
- max_file_size_mb: null,
- },
+ integration: 31,
+ config: AWS_S3_CONFIG,
+})
+
+// Saved with gzip, which is valid for both Parquet and JSONLines, unlike the zstd above that the
+// form has to clear when switching format. Lets the compression tests cover both paths.
+const AWS_S3_GZIP_BATCH_EXPORT = fixture('test-aws-s3-gzip-id', 'AWS S3 gzip Export', {
+ type: 'AwsS3',
+ integration: 31,
+ config: { ...AWS_S3_CONFIG, compression: 'gzip' },
})
const S3_COMPATIBLE_BATCH_EXPORT = fixture('test-s3-compatible-id', 'S3-compatible Export', {
type: 'S3Compatible',
+ integration: 32,
config: {
bucket_name: 'test-bucket',
region: 'auto',
prefix: 'posthog-events/',
- aws_access_key_id: 'AKIAIOSFODNN7EXAMPLE',
- aws_secret_access_key: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
exclude_events: [],
include_events: [],
compression: 'zstd',
- endpoint_url: 'https://test-minio-host:9000',
use_virtual_style_addressing: false,
file_format: 'Parquet',
max_file_size_mb: null,
@@ -302,8 +291,8 @@ const AZUREBLOB_BATCH_EXPORT = fixture('fixture-azureblob', 'Azure Blob Export',
// Single map keyed by id; used to register GET + PATCH mocks dynamically below.
const ALL_BATCH_EXPORTS: BatchExportConfiguration[] = [
- S3_BATCH_EXPORT,
AWS_S3_BATCH_EXPORT,
+ AWS_S3_GZIP_BATCH_EXPORT,
S3_COMPATIBLE_BATCH_EXPORT,
BIGQUERY_BATCH_EXPORT,
BIGQUERY_STALE_BATCH_EXPORT,
@@ -362,7 +351,7 @@ describe('batchExportConfigFormLogic', () => {
post: {
'/api/environments/:team_id/batch_exports/': async ({ request }) => {
lastPostBody = (await request.json()) as Record<string, any>
- return [200, { ...S3_BATCH_EXPORT, id: 'new-export-id' }]
+ return [200, { ...AWS_S3_BATCH_EXPORT, id: 'new-export-id' }]
},
},
patch: patchMocks,
@@ -379,12 +368,12 @@ describe('batchExportConfigFormLogic', () => {
describe('new batch export config initialization', () => {
it('sets isNew to true and loads defaults', async () => {
- await initLogic({ service: 'S3', id: null })
+ await initLogic({ service: 'AwsS3', id: null })
await expectLogic(logic).toMatchValues({
isNew: true,
configuration: partial({
- destination: 'S3',
+ destination: 'AwsS3',
file_format: 'Parquet',
compression: 'zstd',
paused: true,
@@ -396,13 +385,13 @@ describe('batchExportConfigFormLogic', () => {
describe('existing batch export config loading', () => {
it('loads configuration from API', async () => {
- await initLogic({ service: null, id: 'test-s3-id' })
+ await initLogic({ service: null, id: AWS_S3_BATCH_EXPORT.id })
await expectLogic(logic).toMatchValues({
isNew: false,
configuration: partial({
- destination: 'S3',
- name: 'S3 Export',
+ destination: 'AwsS3',
+ name: 'AWS S3 Export',
bucket_name: 'test-bucket',
region: 'us-east-1',
prefix: 'posthog-events/',
@@ -415,23 +404,12 @@ describe('batchExportConfigFormLogic', () => {
const GENERAL_REQUIRED_FIELDS = ['interval', 'name', 'model']
it.each([
{
- service: 'S3' as const,
- fields: [
- 'bucket_name',
- 'region',
- 'prefix',
- 'aws_access_key_id',
- 'aws_secret_access_key',
- 'file_format',
- ],
- },
- {
- // New AwsS3 exports authenticate via an integration, not inline credentials.
+ // AwsS3 exports authenticate via an integration, not inline credentials.
service: 'AwsS3' as const,
fields: ['integration_id', 'bucket_name', 'region', 'prefix', 'file_format'],
},
{
- // New S3Compatible exports authenticate via an integration; endpoint_url lives on it.
+ // S3Compatible exports authenticate via an integration; endpoint_url lives on it.
service: 'S3Compatible' as const,
fields: ['integration_id', 'bucket_name', 'region', 'prefix', 'file_format'],
},
@@ -482,15 +460,14 @@ describe('batchExportConfigFormLogic', () => {
{ bucket: 'my-valid-bucket', error: undefined },
{ bucket: 'my.valid.bucket', error: undefined },
])('bucket "$bucket" → $error', async ({ bucket, error }) => {
- await initLogic({ service: 'S3', id: null })
+ await initLogic({ service: 'AwsS3', id: null })
logic.actions.setConfigurationValues({
...logic.values.configuration,
bucket_name: bucket,
region: 'us-east-1',
prefix: 'test/',
- aws_access_key_id: 'AKIAIOSFODNN7EXAMPLE',
- aws_secret_access_key: 'secret',
+ integration_id: 31,
file_format: 'Parquet',
interval: 'hour',
name: 'Test Export',
@@ -538,7 +515,7 @@ describe('batchExportConfigFormLogic', () => {
{ newFormat: 'JSONLines', expected: null },
{ newFormat: 'Parquet', expected: 'zstd' },
])('new export: switching to $newFormat sets compression to $expected', async ({ newFormat, expected }) => {
- await initLogic({ service: 'S3', id: null })
+ await initLogic({ service: 'AwsS3', id: null })
logic.actions.setConfigurationValue('file_format', newFormat)
await expectLogic(logic).toFinishAllListeners()
@@ -552,7 +529,7 @@ describe('batchExportConfigFormLogic', () => {
])(
'existing export: Parquet/$startCompression -> JSONLines yields $expected',
async ({ startCompression, expected }) => {
- await initLogic({ service: null, id: S3_BATCH_EXPORT.id })
+ await initLogic({ service: null, id: AWS_S3_BATCH_EXPORT.id })
logic.actions.setConfigurationValues({ compression: startCompression })
await expectLogic(logic).toFinishAllListeners()
@@ -580,7 +557,7 @@ describe('batchExportConfigFormLogic', () => {
})
it('existing export: Parquet/gzip survives a JSONLines round-trip (valid for both formats)', async () => {
- await initLogic({ service: null, id: S3_BATCH_EXPORT.id })
+ await initLogic({ service: null, id: AWS_S3_GZIP_BATCH_EXPORT.id })
expect(logic.values.configuration.compression).toBe('gzip')
logic.actions.setConfigurationValue('file_format', 'JSONLines')
@@ -595,7 +572,7 @@ describe('batchExportConfigFormLogic', () => {
describe('invalid persisted compression is dropped on save', () => {
it('clears a JSONLines+zstd combination when saving an unrelated edit', async () => {
- await initLogic({ service: null, id: S3_BATCH_EXPORT.id })
+ await initLogic({ service: null, id: AWS_S3_BATCH_EXPORT.id })
logic.actions.setConfigurationValues({
...logic.values.configuration,
@@ -690,7 +667,7 @@ describe('batchExportConfigFormLogic', () => {
describe('successful update', () => {
it('sends changed field plus untouched fixture defaults', async () => {
- await initLogic({ service: null, id: S3_BATCH_EXPORT.id })
+ await initLogic({ service: null, id: AWS_S3_BATCH_EXPORT.id })
logic.actions.setConfigurationValues({
...logic.values.configuration,
@@ -701,11 +678,14 @@ describe('batchExportConfigFormLogic', () => {
logic.actions.submitConfiguration()
}).toDispatchActions(['submitConfiguration', 'updateBatchExportConfigSuccess'])
- // Derived from the fixture so default changes don't break this test.
+ // Derived from the fixture so default changes don't break this test. The exact match also
+ // pins that the linked integration is re-sent (the backend rejects an S3 update without
+ // one) and that no credentials leak back into config.
expect(lastPatchBody!.destination).toEqual({
- type: 'S3',
+ type: 'AwsS3',
+ integration: 31,
config: {
- ...S3_BATCH_EXPORT.destination.config,
+ ...AWS_S3_BATCH_EXPORT.destination.config,
prefix: 'updated-prefix/',
},
})
@@ -714,16 +694,6 @@ describe('batchExportConfigFormLogic', () => {
describe('getDefaultConfiguration', () => {
it.each([
- {
- service: 'S3',
- expected: {
- destination: 'S3',
- file_format: 'Parquet',
- compression: 'zstd',
- paused: true,
- model: 'events',
- },
- },
{
service: 'AwsS3',
expected: {
@@ -798,30 +768,7 @@ describe('batchExportConfigFormLogic', () => {
describe('create with required fields per destination', () => {
it.each([
{
- name: 'S3',
- service: 'S3' as const,
- requiredValues: {
- bucket_name: 'my-bucket',
- region: 'us-east-1',
- prefix: 'test/',
- aws_access_key_id: 'AKIA',
- aws_secret_access_key: 'secret',
- },
- expectedDestination: {
- type: 'S3',
- config: {
- bucket_name: 'my-bucket',
- region: 'us-east-1',
- prefix: 'test/',
- aws_access_key_id: 'AKIA',
- aws_secret_access_key: 'secret',
- file_format: 'Parquet',
- compression: 'zstd',
- },
- },
- },
- {
- // New AwsS3 exports authenticate via an integration; credentials live on it, and
+ // AwsS3 exports authenticate via an integration; credentials live on it, and
// endpoint_url / use_virtual_style_addressing must not leak into the payload.
name: 'AwsS3',
service: 'AwsS3' as const,
@@ -844,7 +791,7 @@ describe('batchExportConfigFormLogic', () => {
},
},
{
- // New S3Compatible exports authenticate via an integration (which carries endpoint_url);
+ // S3Compatible exports authenticate via an integration (which carries endpoint_url);
// no inline credentials, no leaked encryption / kms_key_id.
name: 'S3Compatible',
service: 'S3Compatible' as const,
@@ -1041,7 +988,6 @@ describe('batchExportConfigFormLogic', () => {
describe('round-trip: load and save preserves destination config', () => {
it.each([
- { name: 'S3', fixture: S3_BATCH_EXPORT },
{ name: 'AwsS3', fixture: AWS_S3_BATCH_EXPORT },
{ name: 'S3Compatible', fixture: S3_COMPATIBLE_BATCH_EXPORT },
{ name: 'BigQuery', fixture: BIGQUERY_BATCH_EXPORT },
@@ -1094,28 +1040,4 @@ describe('batchExportConfigFormLogic', () => {
})
})
})
-
- describe('grandfathered inline S3 exports stay editable without an integration', () => {
- // AwsS3/S3Compatible are integration-backed for new exports, but exports created before
- // integrations existed have inline credentials and no linked integration. Editing one must not
- // require an integration and must preserve the inline credentials — otherwise the export breaks.
- it('saves an inline AwsS3 export, keeping its credentials and sending no integration', async () => {
- await initLogic({ service: null, id: AWS_S3_BATCH_EXPORT.id })
-
- logic.actions.setConfigurationValue('prefix', 'updated-prefix/')
-
- await expectLogic(logic, () => {
- logic.actions.submitConfiguration()
- })
- .toDispatchActions(['submitConfiguration', 'updateBatchExportConfigSuccess'])
- .toFinishAllListeners()
-
- const body = patchBodiesById[AWS_S3_BATCH_EXPORT.id]
- expect(body).not.toBeUndefined()
- expect(body.destination.integration).toBeUndefined()
- expect(body.destination.config.prefix).toBe('updated-prefix/')
- expect(body.destination.config.aws_access_key_id).toBe('AKIAIOSFODNN7EXAMPLE')
- expect(body.destination.config.aws_secret_access_key).toBe('wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY')
- })
- })
})
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/batchExportConfigFormLogic.tsx b/frontend/src/scenes/data-pipelines/batch-exports/batchExportConfigFormLogic.tsx
index d20d11399b15..05ac13c81212 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/batchExportConfigFormLogic.tsx
+++ b/frontend/src/scenes/data-pipelines/batch-exports/batchExportConfigFormLogic.tsx
@@ -568,7 +568,6 @@ export interface batchExportConfigFormLogicValues {
| 'HTTP'
| 'Postgres'
| 'Redshift'
- | 'S3'
| 'S3Compatible'
| 'Snowflake'
| null
@@ -700,7 +699,6 @@ export interface batchExportConfigFormLogicMeta {
| 'HTTP'
| 'Postgres'
| 'Redshift'
- | 'S3'
| 'S3Compatible'
| 'Snowflake'
| null
@@ -712,7 +710,6 @@ export interface batchExportConfigFormLogicMeta {
| 'HTTP'
| 'Postgres'
| 'Redshift'
- | 'S3'
| 'S3Compatible'
| 'Snowflake'
| null
@@ -727,7 +724,6 @@ export interface batchExportConfigFormLogicMeta {
| 'HTTP'
| 'Postgres'
| 'Redshift'
- | 'S3'
| 'S3Compatible'
| 'Snowflake'
| null
@@ -741,7 +737,6 @@ export interface batchExportConfigFormLogicMeta {
| 'HTTP'
| 'Postgres'
| 'Redshift'
- | 'S3'
| 'S3Compatible'
| 'Snowflake'
| null,
@@ -956,7 +951,6 @@ export const batchExportConfigFormLogic = kea<batchExportConfigFormLogicType>([
| 'HTTP'
| 'Postgres'
| 'Redshift'
- | 'S3'
| 'S3Compatible'
| 'Snowflake'
| null
@@ -979,7 +973,6 @@ export const batchExportConfigFormLogic = kea<batchExportConfigFormLogicType>([
| 'HTTP'
| 'Postgres'
| 'Redshift'
- | 'S3'
| 'S3Compatible'
| 'Snowflake'
| null
@@ -997,7 +990,6 @@ export const batchExportConfigFormLogic = kea<batchExportConfigFormLogicType>([
| 'HTTP'
| 'Postgres'
| 'Redshift'
- | 'S3'
| 'S3Compatible'
| 'Snowflake'
| null,
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/batchExportRunsLogic.test.ts b/frontend/src/scenes/data-pipelines/batch-exports/batchExportRunsLogic.test.ts
index 5b3f1e594122..8671188228cc 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/batchExportRunsLogic.test.ts
+++ b/frontend/src/scenes/data-pipelines/batch-exports/batchExportRunsLogic.test.ts
@@ -29,22 +29,19 @@ const MOCK_BATCH_EXPORT_CONFIG: BatchExportConfiguration = {
team_id: 997,
name: 'Test Export',
destination: {
- type: 'S3',
+ type: 'AwsS3',
+ integration: 31,
config: {
bucket_name: 'test-bucket',
region: 'us-east-1',
prefix: 'events/',
- aws_access_key_id: 'AKIAIOSFODNN7EXAMPLE',
- aws_secret_access_key: 'secret',
exclude_events: [],
include_events: [],
compression: 'gzip',
encryption: null,
kms_key_id: null,
- endpoint_url: null,
file_format: 'Parquet',
max_file_size_mb: null,
- use_virtual_style_addressing: false,
},
},
interval: 'hour',
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/batchExportSceneLogic.test.ts b/frontend/src/scenes/data-pipelines/batch-exports/batchExportSceneLogic.test.ts
index 920dabdbbbd8..1797b7e965a6 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/batchExportSceneLogic.test.ts
+++ b/frontend/src/scenes/data-pipelines/batch-exports/batchExportSceneLogic.test.ts
@@ -29,7 +29,7 @@ describe('batchExportSceneLogic', () => {
id: 'test-id',
team_id: 997,
name: 'Test Export',
- destination: { type: 'S3', config: {} },
+ destination: { type: 'AwsS3', config: {} },
interval: 'hour',
paused: false,
model: 'events',
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/destinations/awss3.tsx b/frontend/src/scenes/data-pipelines/batch-exports/destinations/awss3.tsx
index c9ff5cae55f5..a26868bc4f7a 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/destinations/awss3.tsx
+++ b/frontend/src/scenes/data-pipelines/batch-exports/destinations/awss3.tsx
@@ -9,8 +9,7 @@ import type { DestinationDefinition } from './types'
// AWS S3 — the first-class destination for buckets hosted on AWS. No endpoint or virtual-style
// addressing (those are derived from the AWS region); encryption + KMS are AWS-specific so they stay.
//
-// New exports authenticate via an `aws-s3` Integration; exports created before integrations existed
-// keep their inline credentials (grandfathered), detected by the absence of `integration_id`.
+// Credentials come from a linked `aws-s3` Integration, never from this destination's config.
export const awsS3Definition: DestinationDefinition = {
type: 'AwsS3',
usesIntegration: true,
@@ -18,16 +17,13 @@ export const awsS3Definition: DestinationDefinition = {
file_format: 'Parquet',
compression: 'zstd',
}),
- requiredFields: ({ isNew, formValues }) => {
- if (isNew || formValues.integration_id) {
- // New exports must pick an integration; existing integration-backed exports keep theirs.
- return [...(isNew ? ['integration_id', 'file_format'] : []), 'bucket_name', 'region', 'prefix']
- }
- // Grandfathered inline-credential exports keep their original fields when edited.
- return ['bucket_name', 'region', 'prefix']
- },
- // The credential keys remain allowlisted for grandfathered inline exports.
- // TODO: clean up once fully migrated to integration-based credentials
+ requiredFields: ({ isNew }) => [
+ 'integration_id',
+ ...(isNew ? ['file_format'] : []),
+ 'bucket_name',
+ 'region',
+ 'prefix',
+ ],
configKeys: [
'bucket_name',
'region',
@@ -37,8 +33,6 @@ export const awsS3Definition: DestinationDefinition = {
'max_file_size_mb',
'encryption',
'kms_key_id',
- 'aws_access_key_id',
- 'aws_secret_access_key',
],
validate: (formValues) => ({
bucket_name: validateBucketName(formValues.bucket_name),
@@ -51,12 +45,9 @@ export const awsS3Definition: DestinationDefinition = {
isNew={isNew}
formValues={formValues}
regionOptions={AWS_ONLY_REGION_OPTIONS}
- awsBranded
showEncryption
- showEndpointUrl={false}
showVirtualStyleAddressing={false}
integrationKind="aws-s3"
- migrationNotice="S3 batch exports are moving to integration-based credentials. This export will be migrated automatically — no action required."
/>
)
},
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/destinations/common.tsx b/frontend/src/scenes/data-pipelines/batch-exports/destinations/common.tsx
index 1982f7eb9ffc..ac961da3d466 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/destinations/common.tsx
+++ b/frontend/src/scenes/data-pipelines/batch-exports/destinations/common.tsx
@@ -1,6 +1,4 @@
-import { type ReactNode } from 'react'
-
-import { LemonBanner, LemonCheckbox, LemonInput, LemonSelect, Link } from '@posthog/lemon-ui'
+import { LemonCheckbox, LemonInput, LemonSelect, Link } from '@posthog/lemon-ui'
import { IntegrationChoice } from 'lib/components/CyclotronJob/integrations/IntegrationChoice'
import { LemonField } from 'lib/lemon-ui/LemonField'
@@ -290,70 +288,39 @@ export const S3_FAMILY_EVENT_TABLE_EXTRA_FIELDS: Record<string, DatabaseSchemaFi
},
}
-// Shared form fields for the S3-family destinations (S3 legacy, AwsS3, S3Compatible). Per-destination
-// definitions toggle the AWS-only (encryption/KMS) and S3-compatible-only (endpoint/virtual-style)
-// blocks and supply the region option set; everything else is identical.
+// Shared form fields for the AwsS3 and S3Compatible destinations. Per-destination definitions toggle
+// the AWS-only (encryption/KMS) and S3-compatible-only (virtual-style) blocks and supply the region
+// option set; everything else is identical.
//
-// New AwsS3/S3Compatible exports authenticate via a linked Integration (pass `integrationKind`);
-// grandfathered exports created before integrations existed keep their inline credential UI, detected
-// by the absence of a linked integration. Mirrors the Postgres destination's `useIntegration` pattern.
+// Credentials, and the endpoint URL for S3-compatible providers, live in the linked Integration, so
+// this form only picks the integration.
export function S3FamilyFields({
isNew,
formValues,
regionOptions,
- awsBranded,
allowCustomRegion = false,
showEncryption,
- showEndpointUrl,
- endpointUrlRequired = false,
showVirtualStyleAddressing,
- endpointHelpText,
integrationKind,
- migrationNotice,
}: {
isNew: boolean
formValues: Record<string, any>
regionOptions: { value: string; label: string }[]
- // Prefix the credential labels with "AWS" — only true for AWS S3, not the S3-compatible catch-all.
- awsBranded: boolean
// Let users type a region not in the preset list. True for the S3-compatible catch-all, where we
// can't enumerate every provider's regions; false for AWS S3, whose regions are a closed set.
allowCustomRegion?: boolean
showEncryption: boolean
- showEndpointUrl: boolean
- endpointUrlRequired?: boolean
showVirtualStyleAddressing: boolean
- endpointHelpText?: ReactNode
- // When set, this destination authenticates via an Integration of this kind. The credential and
- // endpoint inputs are replaced by an integration picker for new and integration-backed exports.
- integrationKind?: IntegrationKind
- // Banner shown above the fields whenever the inline (non-integration) UI is rendered — used to
- // tell users the export will be migrated to integrations automatically.
- migrationNotice?: ReactNode
+ // This destination authenticates via an Integration of this kind.
+ integrationKind: IntegrationKind
}): JSX.Element {
- // New exports must pick an integration; existing ones keep whatever they were created with.
- const useIntegration = !!integrationKind && (isNew || !!formValues.integration_id)
-
- // The KMS key is a config field (not a credential) that only applies to aws:kms encryption. With
- // inline credentials it sits in the credentials row; in the integration form that row is gone, so
- // it's surfaced next to the encryption select instead. Rendered in exactly one place either way.
- const kmsKeyIdField = showEncryption && formValues.encryption == 'aws:kms' && (
- <LemonField name="kms_key_id" label="AWS KMS Key ID" className="flex-1">
- <LemonInput placeholder={isNew ? 'e.g. 1234abcd-12ab-34cd-56ef-1234567890ab' : 'leave unchanged'} />
- </LemonField>
- )
-
return (
<>
- {!useIntegration && migrationNotice ? <LemonBanner type="warning">{migrationNotice}</LemonBanner> : null}
-
- {useIntegration && integrationKind ? (
- <LemonField name="integration_id" label="Integration">
- {({ value, onChange }) => (
- <IntegrationChoice integration={integrationKind} value={value} onChange={onChange} />
- )}
- </LemonField>
- ) : null}
+ <LemonField name="integration_id" label="Integration">
+ {({ value, onChange }) => (
+ <IntegrationChoice integration={integrationKind} value={value} onChange={onChange} />
+ )}
+ </LemonField>
<div className="flex gap-4">
<LemonField name="bucket_name" label="Bucket" className="flex-1">
@@ -416,58 +383,15 @@ export function S3FamilyFields({
</LemonField>
)}
- {/* With an integration the credentials row is hidden, so the KMS key lives here instead. */}
- {useIntegration && kmsKeyIdField}
- </div>
-
- {!useIntegration && (
- <div className="flex gap-4">
- <LemonField
- name="aws_access_key_id"
- label={awsBranded ? 'AWS Access Key ID' : 'Access Key ID'}
- className="flex-1"
- >
- <LemonInput
- placeholder={isNew ? 'e.g. AKIAIOSFODNN7EXAMPLE' : 'Leave unchanged'}
- autoComplete="off"
- />
- </LemonField>
-
- <LemonField
- name="aws_secret_access_key"
- label={awsBranded ? 'AWS Secret Access Key' : 'Secret Access Key'}
- className="flex-1"
- >
+ {/* The KMS key is config, not a credential, and only applies to aws:kms encryption. */}
+ {showEncryption && formValues.encryption == 'aws:kms' && (
+ <LemonField name="kms_key_id" label="AWS KMS Key ID" className="flex-1">
<LemonInput
- placeholder={isNew ? 'e.g. secret-key' : 'Leave unchanged'}
- type="password"
- autoComplete="new-password"
+ placeholder={isNew ? 'e.g. 1234abcd-12ab-34cd-56ef-1234567890ab' : 'leave unchanged'}
/>
</LemonField>
-
- {kmsKeyIdField}
- </div>
- )}
-
- {!useIntegration && showEndpointUrl && (
- <LemonField
- name="endpoint_url"
- label="Endpoint URL"
- showOptional={!endpointUrlRequired}
- info={
- endpointHelpText ?? (
- <>
- The endpoint URL corresponding to your provider (e.g. Cloudflare R2, DigitalOcean
- Spaces, Supabase, etc.). Works with any S3-compatible storage.
- </>
- )
- }
- >
- <LemonInput
- placeholder={isNew ? 'e.g. https://<account-id>.r2.cloudflarestorage.com' : 'Leave unchanged'}
- />
- </LemonField>
- )}
+ )}
+ </div>
{showVirtualStyleAddressing && (
<LemonField
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/destinations/index.ts b/frontend/src/scenes/data-pipelines/batch-exports/destinations/index.ts
index 57816214b2d5..27c880ef754f 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/destinations/index.ts
+++ b/frontend/src/scenes/data-pipelines/batch-exports/destinations/index.ts
@@ -5,13 +5,11 @@ import { databricksDefinition } from './databricks'
import { httpDefinition } from './http'
import { postgresDefinition } from './postgres'
import { redshiftDefinition } from './redshift'
-import { s3Definition } from './s3'
import { s3CompatibleDefinition } from './s3compatible'
import { snowflakeDefinition } from './snowflake'
import type { BatchExportServiceType, DestinationDefinition } from './types'
export const DESTINATIONS: Record<BatchExportServiceType, DestinationDefinition> = {
- S3: s3Definition,
AwsS3: awsS3Definition,
S3Compatible: s3CompatibleDefinition,
Postgres: postgresDefinition,
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/destinations/s3.tsx b/frontend/src/scenes/data-pipelines/batch-exports/destinations/s3.tsx
deleted file mode 100644
index 265ddd0bf574..000000000000
--- a/frontend/src/scenes/data-pipelines/batch-exports/destinations/s3.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import { S3FamilyFields, S3_FAMILY_EVENT_TABLE_EXTRA_FIELDS, S3_REGION_OPTIONS, validateBucketName } from './common'
-import type { DestinationDefinition } from './types'
-
-// Legacy `S3` destination, kept for batch exports created before the AwsS3 / S3Compatible split and
-// hidden from the picker. It shows every S3-family field so any not-yet-reclassified row keeps working.
-// TODO: cleanup once all batch exports have been migrated to AwsS3 or S3Compatible
-export const s3Definition: DestinationDefinition = {
- type: 'S3',
- defaults: () => ({
- file_format: 'Parquet',
- compression: 'zstd',
- }),
- requiredFields: ({ isNew }) => [
- 'bucket_name',
- 'region',
- 'prefix',
- ...(isNew ? ['aws_access_key_id'] : []),
- ...(isNew ? ['aws_secret_access_key'] : []),
- ...(isNew ? ['file_format'] : []),
- ],
- validate: (formValues) => ({
- bucket_name: validateBucketName(formValues.bucket_name),
- }),
- eventTableExtraFields: S3_FAMILY_EVENT_TABLE_EXTRA_FIELDS,
- eventTableOverrides: { includeGenericPersonFields: false },
- Fields: function S3Fields({ isNew, formValues }) {
- return (
- <S3FamilyFields
- isNew={isNew}
- formValues={formValues}
- regionOptions={S3_REGION_OPTIONS}
- awsBranded
- allowCustomRegion
- showEncryption
- showEndpointUrl
- showVirtualStyleAddressing
- migrationNotice="S3 batch exports are moving to integration-based credentials. This export will be migrated automatically to an AWS S3 or S3-compatible destination — no action required."
- />
- )
- },
-}
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/destinations/s3compatible.tsx b/frontend/src/scenes/data-pipelines/batch-exports/destinations/s3compatible.tsx
index 6b7722ff6311..bb93ffd791e8 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/destinations/s3compatible.tsx
+++ b/frontend/src/scenes/data-pipelines/batch-exports/destinations/s3compatible.tsx
@@ -1,12 +1,11 @@
import { S3FamilyFields, S3_FAMILY_EVENT_TABLE_EXTRA_FIELDS, S3_REGION_OPTIONS, validateBucketName } from './common'
import type { DestinationDefinition } from './types'
-// Catch-all for any non-AWS S3-compatible object storage. Requires an endpoint URL and exposes
-// virtual-style addressing; no AWS-specific encryption / KMS fields.
+// Catch-all for any non-AWS S3-compatible object storage. Exposes virtual-style addressing; no
+// AWS-specific encryption / KMS fields.
//
-// New exports authenticate via an `s3-compatible` Integration (which also carries the endpoint URL);
-// exports created before integrations existed keep their inline credentials + endpoint (grandfathered),
-// detected by the absence of `integration_id`.
+// Credentials and the provider endpoint URL come from a linked `s3-compatible` Integration, never
+// from this destination's config.
export const s3CompatibleDefinition: DestinationDefinition = {
type: 'S3Compatible',
usesIntegration: true,
@@ -14,17 +13,13 @@ export const s3CompatibleDefinition: DestinationDefinition = {
file_format: 'Parquet',
compression: 'zstd',
}),
- requiredFields: ({ isNew, formValues }) => {
- if (isNew || formValues.integration_id) {
- // New exports must pick an integration (endpoint_url lives on it); existing
- // integration-backed exports keep theirs.
- return [...(isNew ? ['integration_id', 'file_format'] : []), 'bucket_name', 'region', 'prefix']
- }
- // Grandfathered inline-credential exports keep their original fields, including endpoint_url.
- return ['bucket_name', 'region', 'prefix', 'endpoint_url']
- },
- // The credential keys remain allowlisted for grandfathered inline exports.
- // TODO: clean up once fully migrated to integration-based credentials
+ requiredFields: ({ isNew }) => [
+ 'integration_id',
+ ...(isNew ? ['file_format'] : []),
+ 'bucket_name',
+ 'region',
+ 'prefix',
+ ],
configKeys: [
'bucket_name',
'region',
@@ -33,9 +28,6 @@ export const s3CompatibleDefinition: DestinationDefinition = {
'compression',
'max_file_size_mb',
'use_virtual_style_addressing',
- 'aws_access_key_id',
- 'aws_secret_access_key',
- 'endpoint_url',
],
validate: (formValues) => ({
bucket_name: validateBucketName(formValues.bucket_name),
@@ -48,14 +40,10 @@ export const s3CompatibleDefinition: DestinationDefinition = {
isNew={isNew}
formValues={formValues}
regionOptions={S3_REGION_OPTIONS}
- awsBranded={false}
allowCustomRegion
showEncryption={false}
- showEndpointUrl
- endpointUrlRequired
showVirtualStyleAddressing
integrationKind="s3-compatible"
- migrationNotice="PostHog is moving S3 batch exports to integration-based credentials. This export will be migrated automatically — no action required."
/>
)
},
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/types.ts b/frontend/src/scenes/data-pipelines/batch-exports/types.ts
index ae1ce3a9466b..1b0bd6a32352 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/types.ts
+++ b/frontend/src/scenes/data-pipelines/batch-exports/types.ts
@@ -9,7 +9,6 @@ import {
BatchExportServiceHTTP,
BatchExportServicePostgres,
BatchExportServiceRedshift,
- BatchExportServiceS3,
BatchExportServiceS3Compatible,
BatchExportServiceSnowflake,
} from '~/types'
@@ -23,7 +22,6 @@ export type BatchExportConfigurationForm = Omit<
Partial<BatchExportServicePostgres['config']> &
Partial<BatchExportServiceRedshift['config']> &
Partial<BatchExportServiceBigQuery['config']> &
- Partial<BatchExportServiceS3['config']> &
Partial<BatchExportServiceAwsS3['config']> &
Partial<BatchExportServiceS3Compatible['config']> &
Partial<BatchExportServiceSnowflake['config']> &
@@ -31,7 +29,6 @@ export type BatchExportConfigurationForm = Omit<
Partial<BatchExportServiceHTTP['config']> &
Partial<BatchExportServiceAzureBlob['config']> & {
destination:
- | 'S3'
| 'AwsS3'
| 'S3Compatible'
| 'Snowflake'
diff --git a/frontend/src/scenes/data-pipelines/utils/nonHogFunctionTemplatesLogic.tsx b/frontend/src/scenes/data-pipelines/utils/nonHogFunctionTemplatesLogic.tsx
index bd5517dc8808..5573d11d0997 100644
--- a/frontend/src/scenes/data-pipelines/utils/nonHogFunctionTemplatesLogic.tsx
+++ b/frontend/src/scenes/data-pipelines/utils/nonHogFunctionTemplatesLogic.tsx
@@ -192,11 +192,6 @@ export const nonHogFunctionTemplatesLogic = kea<nonHogFunctionTemplatesLogicType
featureFlags[FEATURE_FLAGS.BATCH_EXPORTS_POSTHOG_HTTP] || user?.is_impersonated || user?.is_staff
const services = BATCH_EXPORT_SERVICE_NAMES.filter((service) => {
- // Legacy alias — superseded in the picker by AwsS3 + S3Compatible. Kept in the
- // service list so existing 'S3' rows still load and render.
- if (service === 'S3') {
- return false
- }
// HTTP is only for Cloud-to-Cloud migrations; gated behind a flag / staff.
if (service === 'HTTP') {
return httpEnabled
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index f776eca8e273..a511153af342 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -6672,34 +6672,14 @@ export interface SimpleDataWarehouseTable {
row_count: number
}
-export type BatchExportServiceS3 = {
- type: 'S3'
- config: {
- bucket_name: string
- region: string
- prefix: string
- aws_access_key_id: string
- aws_secret_access_key: string
- exclude_events: string[]
- include_events: string[]
- compression: string | null
- encryption: string | null
- kms_key_id: string | null
- endpoint_url: string | null
- file_format: string
- max_file_size_mb: number | null
- use_virtual_style_addressing: boolean
- }
-}
-
+// Credentials live on the linked `aws-s3` integration, not in the config.
export type BatchExportServiceAwsS3 = {
type: 'AwsS3'
+ integration: number
config: {
bucket_name: string
region: string
prefix: string
- aws_access_key_id: string
- aws_secret_access_key: string
exclude_events: string[]
include_events: string[]
compression: string | null
@@ -6710,18 +6690,17 @@ export type BatchExportServiceAwsS3 = {
}
}
+// Credentials and the provider endpoint URL live on the linked `s3-compatible` integration.
export type BatchExportServiceS3Compatible = {
type: 'S3Compatible'
+ integration: number
config: {
bucket_name: string
region: string
prefix: string
- aws_access_key_id: string
- aws_secret_access_key: string
exclude_events: string[]
include_events: string[]
compression: string | null
- endpoint_url: string
use_virtual_style_addressing: boolean
file_format: string
max_file_size_mb: number | null
@@ -6851,9 +6830,6 @@ export type BatchExportServiceAzureBlob = {
// frontend/public/services/
// and update RenderBatchExportIcon
export const BATCH_EXPORT_SERVICE_NAMES: BatchExportService['type'][] = [
- // 'S3' is the legacy alias kept for reading existing rows and the BatchExportScene validity
- // guard — it is filtered out of the destination picker in favour of AwsS3 + S3Compatible.
- 'S3',
'AwsS3',
'S3Compatible',
'Snowflake',
@@ -6865,7 +6841,6 @@ export const BATCH_EXPORT_SERVICE_NAMES: BatchExportService['type'][] = [
'AzureBlob',
]
export type BatchExportService =
- | BatchExportServiceS3
| BatchExportServiceAwsS3
| BatchExportServiceS3Compatible
| BatchExportServiceSnowflake