Storybook composition ref unreachable in CI
Storybook composition embeds other Storybooks via the refs field in main.js. In CI, if a referenced URL is private, offline, or not yet deployed, the ref cannot load, and a build that validates refs or a test-runner reading the index can fail.
What this error means
The build or runner logs that a ref could not be loaded, or the composed Storybook shows an unreachable ref, naming the URL from refs.
storybook
Could not fetch composed Storybook at ref "design-system":
https://storybook.internal.example.com (request failed)Common causes
The referenced Storybook is not reachable from CI
The ref URL is internal or behind auth, so the CI runner cannot fetch its index.json.
The composed Storybook is not deployed yet
The ref points at a build that has not been published, so the URL 404s during CI.
How to fix it
Make refs reachable or conditional in CI
- Confirm the ref URL responds from the runner's network.
- For private refs, provide the reachable URL or credentials.
- Skip or stub refs that are not needed for the CI build.
.storybook/main.ts
// .storybook/main.ts
export default {
refs: (config, { configType }) =>
configType === 'PRODUCTION'
? { 'design-system': { title: 'DS', url: 'https://ds.example.com' } }
: {},
};Publish the referenced Storybook first
Order the pipeline so the composed Storybook is deployed before builds that reference it.
How to prevent it
- Ensure ref URLs are reachable from CI or make them conditional.
- Deploy referenced Storybooks before dependent builds.
- Avoid pointing refs at private hosts CI cannot reach.
Related guides
Storybook "No story files found for the specified pattern" in CIFix Storybook "No story files found for the specified pattern" in CI - the glob in .storybook/main.js matched…
Storybook "storybook dev" port already in use in CIFix "storybook dev" failing because the port is already in use in CI - another process (a leftover Storybook…
Storybook test-runner "Cannot connect to Storybook at http://127.0.0.1:6006" in CIFix @storybook/test-runner "Cannot connect to Storybook at http://127.0.0.1:6006" in CI - the runner reached…