Skip to content

Commit 9fbc7e5

Browse files
committed
fix(amplitude): default the saved credential's data residency to us
1 parent d9e40e2 commit 9fbc7e5

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎apps/sim/lib/credentials/service-account-secret.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,23 @@ describe('a token provider whose region or host defaults to the one it always us
927927
})
928928
})
929929

930+
it.each([
931+
[undefined, 'https://amplitude.com/api/2/events/list', 'us'],
932+
['eu', 'https://analytics.eu.amplitude.com/api/2/events/list', 'eu'],
933+
])(
934+
'checks an Amplitude project with residency %s at %s and stores it as %s',
935+
async (domain, url, stored) => {
936+
const result = await verifyAndBuildServiceAccountSecret('amplitude-service-account', {
937+
apiToken: 'secret-1',
938+
providerWorkspaceId: 'api-key-1',
939+
...(domain === undefined ? {} : { domain }),
940+
})
941+
942+
expect(requestedUrl()).toBe(url)
943+
expect(JSON.parse(result.encryptedServiceAccountKey)).toMatchObject({ domain: stored })
944+
}
945+
)
946+
930947
it.each([
931948
['launchdarkly-service-account', 'LaunchDarkly'],
932949
['langsmith-service-account', 'LangSmith'],

‎apps/sim/lib/credentials/token-service-accounts/descriptors.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2643,13 +2643,14 @@ export const TOKEN_SERVICE_ACCOUNT_DESCRIPTORS: Record<
26432643
label: 'Data residency',
26442644
placeholder: 'us or eu',
26452645
secret: false,
2646+
defaultValue: 'us',
26462647
hintPattern: /^(us|eu|US|EU)$/,
26472648
hintMessage: 'Enter us or eu, the region your Amplitude project stores data in.',
26482649
},
26492650
],
26502651
docsUrl: 'https://docs.sim.ai/integrations/amplitude',
26512652
helpText:
2652-
"In Amplitude, open Settings > Projects, choose the project, and copy the API key and secret key from its General tab. Enter eu only for a project hosted in Amplitude's EU data center.",
2653+
"In Amplitude, open Settings > Projects, choose the project, and copy the API key and secret key from its General tab. Change the data residency to eu only for a project hosted in Amplitude's EU data center.",
26532654
invalidCredentialsHelp:
26542655
'Amplitude rejected this API key and secret key. Check that both come from the same project, and that the data residency matches the region the project is hosted in.',
26552656
},

0 commit comments

Comments
 (0)