fix: Store ID param sent to Content Platform client#3265
Conversation
WalkthroughUpdated Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/core/src/server/content/service.ts`:
- Around line 190-192: The derivation of storeId using (config.contentSource as
Record<string, string>)?.project ?? 'faststore' is unsafe and doesn't guard
against empty/whitespace values; instead, explicitly narrow and validate
config.contentSource before reading .project (e.g., check typeof
config.contentSource === 'object' && config.contentSource !== null && 'project'
in config.contentSource), ensure the value is a non-empty trimmed string (reject
'' or whitespace), and fall back to 'faststore' if validation fails; apply the
same change consistently for the storeId logic in service.ts (symbol: storeId)
and cms/index.ts (the equivalent storeId computation) or extract a small helper
(e.g., getValidatedStoreId) and reuse it.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5be84130-f4e4-437e-a080-7b9974d2e5cc
📒 Files selected for processing (1)
packages/core/src/server/content/service.ts
What's the purpose of this pull request?
Fix the
storeIdparam being sent to the Content Platform client requests, used to fetch entries and pages. We need to make sure look to thecontentSource.project(in discovery config) to check if the project is using a store different than the old default one (faststore).It will prevent errors when setting up new stores through WebOps onboarding (see image below).
How it works?
Ensure the store ID is correctly read from
contentSource.projectwhen is set.Summary by CodeRabbit