feat(importer): add MIXPANEL_DATA_RESIDENCY env var for EU/India data centers#360
feat(importer): add MIXPANEL_DATA_RESIDENCY env var for EU/India data centers#360mraj602 wants to merge 2 commits intoOpenpanel-dev:mainfrom
Conversation
… centers Mixpanel hosts data in 3 regions (US, EU, India) with different base URLs. The importer was hardcoded to US endpoints, breaking imports for EU/India projects. Adds MIXPANEL_DATA_RESIDENCY env var (us | eu | in, default: us) that resolves both the export and engage API base URLs to the correct regional endpoints.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a Mixpanel data residency option: a new ChangesMixpanel Data Residency Configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/importer/src/providers/mixpanel.ts`:
- Around line 64-70: The getResidencyUrls() method currently silently falls back
to the US endpoints when process.env.MIXPANEL_DATA_RESIDENCY is unrecognized;
update getResidencyUrls (or move this logic into the MixpanelProvider
constructor/initializer if a logger instance is needed) to detect when the
chosen residency key is not present in MixpanelProvider.dataResidencyUrls and
emit a clear warning (use this.logger.warn when available, otherwise
console.warn) that includes the invalid env value and that the code is falling
back to "us"; keep the returned fallback behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3b8d15dd-7390-400d-a3de-a908a0552461
📒 Files selected for processing (3)
.env.exampleapps/public/content/docs/self-hosting/environment-variables.mdxpackages/importer/src/providers/mixpanel.ts
Summary
Mixpanel hosts data in 3 regions (US, EU, India) with different base URLs. The importer was hardcoded to US endpoints, breaking imports for EU/India projects.
What changed
packages/importer/src/providers/mixpanel.ts—MixpanelProviderreadsMIXPANEL_DATA_RESIDENCYat startup and resolves both the export and engage API base URLs to the correct regional endpoints.env.example— documented with default valueapps/public/content/docs/self-hosting/environment-variables.mdx— added to the environment variables referenceHow it works
us(default)data.mixpanel.commixpanel.comeudata-eu.mixpanel.comeu.mixpanel.comindata-in.mixpanel.comin.mixpanel.comDefaults to
usif unset — fully backwards compatible.Test plan
MIXPANEL_DATA_RESIDENCY=euin the worker envdata-eu.mixpanel.com(check worker logs)data.mixpanel.comCloses #359
Summary by CodeRabbit
New Features
Documentation