storybook: [Bug]: TypeError: Cannot read properties of undefined (reading 'clientApi')

Describe the bug

I have monorepo with storybook-host using react

TypeError: Cannot read properties of undefined (reading 'clientApi')

       initStoryshots({
                      ^
          configPath: path.resolve(__dirname, '../../storybook-host/.storybook/preview.tsx')
        });
      

      at ../../../node_modules/@storybook/addon-storyshots/dist/frameworks/react/loader.js:34:49
      at Object.load (../../../node_modules/@storybook/addon-storyshots/dist/frameworks/react/loader.js:39:23)
      at loadFramework (../../../node_modules/@storybook/addon-storyshots/dist/frameworks/frameworkLoader.js:36:19)
      at testStorySnapshots (../../../node_modules/@storybook/addon-storyshots/dist/api/index.js:28:99)
      at Object.<anonymous> (setup-jest.ts:7:15)

To Reproduce

import initStoryshots from '@storybook/addon-storyshots';
import path from "path";

initStoryshots({
  configPath: path.resolve(__dirname, '../../storybook-host/.storybook/preview.tsx')
});

System

No response

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 4
  • Comments: 20 (6 by maintainers)

Most upvoted comments

@shilman can you please label it back as a “Bug”?

I think what you need to do is set storyStoreV7 to false in your .storybook/main.js:

export default {
  // ...
  features: {
    storyStoreV7: false,
  }
}

Can you please try this?