Skip to content

[Bug]: Storybook 7 scanning folders outside stories path #21031

@bazo

Description

@bazo

Describe the bug

I have project where the root contains backend, docker configuration, docker volumes and frontend files in frontend folder

the config file is in frontend/.storybook

import type { StorybookConfig } from "@storybook/react-vite";
import { globby } from "globby";

const config: StorybookConfig = {
	stories: async () => {
		return await globby([
			`${__dirname}/../**/*.mdx`,
			`${__dirname}/../(admin|components|portal)/**/*.stories.@(js|jsx|ts|tsx)`,
		]);
	},
	// stories: [
	// 	"!*docker/*",
	// 	`${__dirname}/../**/*.mdx`,
	// 	`${__dirname}/../(admin|components|portal)/**/*.stories.@(js|jsx|ts|tsx)`,
	// ],
	addons: [
		"@storybook/addon-links",
		"@storybook/addon-essentials",
		"@storybook/addon-interactions",
	],
	framework: {
		name: "@storybook/react-vite",
		options: {},
	},
	docs: {
		autodocs: "tag",
	},
};
export default config;

there is one example story in frontend/stories/introduction.mdx which is found

but the storybook cli is scanning other folders outside specified paths, most importantly the docker volumes where it failes on access denied as some files are created by root

the process starts, browser opens, i see the introduction story in sidebar and then the process immediately exits

the error is

info => Starting manager..
info => Serving static files from ././.yarn/cache/@storybook-manager-npm-7.0.0-beta.45-36bf73f6f6-8bd66b773c.zip/node_modules/@storybook/manager/static at /sb-common-assets
node:fs:1437
  handleErrorFromBinding(ctx);
  ^

Error: EACCES: permission denied, scandir 'project-path/docker/volumes/mysql/#innodb_redo'
    at Object.readdirSync (node:fs:1437:3)
    at NodeFS.readdirSync (/tmp/12a8f9063865c3d6373e914109833c32.cjs:25120:26)
    at makeCallSync.subPath.subPath (/tmp/12a8f9063865c3d6373e914109833c32.cjs:27394:26)
    at ZipOpenFS.makeCallSync (/tmp/12a8f9063865c3d6373e914109833c32.cjs:27497:14)
    at ZipOpenFS.readdirSync (/tmp/12a8f9063865c3d6373e914109833c32.cjs:27393:17)
    at VirtualFS.readdirSync (/tmp/12a8f9063865c3d6373e914109833c32.cjs:26641:24)
    at PosixFS.readdirSync (/tmp/12a8f9063865c3d6373e914109833c32.cjs:26641:24)
    at NodePathFS.readdirSync (/tmp/12a8f9063865c3d6373e914109833c32.cjs:26641:24)
    at GlobSync._readdir (project-path/.yarn/cache/glob-npm-7.2.3-2d866d17a5-29452e97b3.zip/node_modules/glob/sync.js:288:46)
    at GlobSync._readdirInGlobStar (project-path/.yarn/cache/glob-npm-7.2.3-2d866d17a5-29452e97b3.zip/node_modules/glob/sync.js:267:20) {
  errno: -13,
  syscall: 'scandir',
  code: 'EACCES',
  path: 'project-path/docker/volumes/mysql/#innodb_redo'
}

i don't understand why is it scanning folders that are not defined in the stories config property? doesn't matter if i just define paths or use custom function

what can i do to make this work?
thanks

To Reproduce

No response

System

Environment Info:

  System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  Binaries:
    Node: 19.5.0 - ~/.nvm/versions/node/v19.5.0/bin/node
    Yarn: 3.3.1 - ~/.nvm/versions/node/v19.5.0/bin/yarn
    npm: 9.3.1 - ~/.nvm/versions/node/v19.5.0/bin/npm

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions