Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Singleton client API not yet initialized... #13793

Closed
IvanovRoman opened this issue Feb 2, 2021 · 4 comments
Closed

Error: Singleton client API not yet initialized... #13793

IvanovRoman opened this issue Feb 2, 2021 · 4 comments

Comments

@IvanovRoman
Copy link

This error appears. How to fix it? Could there be a problem in the webpack configuration?

client_api.js:93 Uncaught Error: Singleton client API not yet initialized, cannot call addParameters
at addParameters (client_api.js:93)
at Object../node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js (config.js-generated-other-entry.js:35)
at webpack_require (bootstrap:848)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at 3.8b98ff28180af042f9ee.bundle.js:1
addParameters @ client_api.js:93
./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js @ config.js-generated-other-entry.js:35
webpack_require @ bootstrap:848
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ 3.8b98ff28180af042f9ee.bundle.js:1
client_api.js:83 Uncaught Error: Singleton client API not yet initialized, cannot call addDecorator
at addDecorator (client_api.js:83)
at config.js-generated-other-entry.js:24
at Array.forEach ()
at Object../node_modules/@storybook/addon-docs/dist/frameworks/react/config.js-generated-other-entry.js (config.js-generated-other-entry.js:23)
at webpack_require (bootstrap:848)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at 4.8b98ff28180af042f9ee.bundle.js:1
addDecorator @ client_api.js:83
(anonymous) @ config.js-generated-other-entry.js:24
./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js-generated-other-entry.js @ config.js-generated-other-entry.js:23
webpack_require @ bootstrap:848
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ 4.8b98ff28180af042f9ee.bundle.js:1
client_api.js:83 Uncaught Error: Singleton client API not yet initialized, cannot call addDecorator
at addDecorator (client_api.js:83)
at addDecorator.js-generated-other-entry.js:24
at Array.forEach ()
at Object../node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js (addDecorator.js-generated-other-entry.js:23)
at webpack_require (bootstrap:848)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at 5.8b98ff28180af042f9ee.bundle.js:1
addDecorator @ client_api.js:83
(anonymous) @ addDecorator.js-generated-other-entry.js:24
./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js @ addDecorator.js-generated-other-entry.js:23
webpack_require @ bootstrap:848
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ 5.8b98ff28180af042f9ee.bundle.js:1
client_api.js:111 Uncaught Error: Singleton client API not yet initialized, cannot call addArgTypesEnhancer
at addArgTypesEnhancer (client_api.js:111)
at addArgs.js-generated-other-entry.js:43
at Array.forEach ()
at Object../node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js (addArgs.js-generated-other-entry.js:42)
at webpack_require (bootstrap:848)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at 6.8b98ff28180af042f9ee.bundle.js:1
addArgTypesEnhancer @ client_api.js:111
(anonymous) @ addArgs.js-generated-other-entry.js:43
./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js @ addArgs.js-generated-other-entry.js:42
webpack_require @ bootstrap:848
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ 6.8b98ff28180af042f9ee.bundle.js:1
client_api.js:83 Uncaught Error: Singleton client API not yet initialized, cannot call addDecorator
at addDecorator (client_api.js:83)
at addDecorator.js-generated-other-entry.js:24
at Array.forEach ()
at Object../node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js (addDecorator.js-generated-other-entry.js:23)
at webpack_require (bootstrap:848)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at 7.8b98ff28180af042f9ee.bundle.js:1
addDecorator @ client_api.js:83
(anonymous) @ addDecorator.js-generated-other-entry.js:24
./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js @ addDecorator.js-generated-other-entry.js:23
webpack_require @ bootstrap:848
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ 7.8b98ff28180af042f9ee.bundle.js:1
client_api.js:83 Uncaught Error: Singleton client API not yet initialized, cannot call addDecorator
at addDecorator (client_api.js:83)
at addDecorator.js-generated-other-entry.js:24
at Array.forEach ()
at Object../node_modules/@storybook/addon-backgrounds/dist/preset/addDecorator.js-generated-other-entry.js (addDecorator.js-generated-other-entry.js:23)
at webpack_require (bootstrap:848)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at 8.8b98ff28180af042f9ee.bundle.js:1
addDecorator @ client_api.js:83
(anonymous) @ addDecorator.js-generated-other-entry.js:24
./node_modules/@storybook/addon-backgrounds/dist/preset/addDecorator.js-generated-other-entry.js @ addDecorator.js-generated-other-entry.js:23
webpack_require @ bootstrap:848
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ 8.8b98ff28180af042f9ee.bundle.js:1
client_api.js:93 Uncaught Error: Singleton client API not yet initialized, cannot call addParameters
at addParameters (client_api.js:93)
at Object../node_modules/@storybook/addon-backgrounds/dist/preset/addParameter.js-generated-other-entry.js (addParameter.js-generated-other-entry.js:35)
at webpack_require (bootstrap:848)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at 9.8b98ff28180af042f9ee.bundle.js:1
addParameters @ client_api.js:93
./node_modules/@storybook/addon-backgrounds/dist/preset/addParameter.js-generated-other-entry.js @ addParameter.js-generated-other-entry.js:35
webpack_require @ bootstrap:848
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ 9.8b98ff28180af042f9ee.bundle.js:1
client_api.js:93 Uncaught Error: Singleton client API not yet initialized, cannot call addParameters
at addParameters (client_api.js:93)
at Object../.storybook/preview.js-generated-config-entry.js (preview.js-generated-config-entry.js:35)
at webpack_require (bootstrap:848)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at 10.8b98ff28180af042f9ee.bundle.js:1

@yngvebn
Copy link
Contributor

yngvebn commented Feb 4, 2021

@IvanovRoman could you share some of your config? tsconfig, main.ts/js?

@IvanovRoman
Copy link
Author

@IvanovRoman could you share some of your config? tsconfig, main.ts/js?

I tried remove node_modules and yarn install. This not helped.

@jonluca
Copy link

jonluca commented May 25, 2021

I see you closed this - were you able to figure out what the underlying issue was @IvanovRoman?

@IvanovRoman
Copy link
Author

I see you closed this - were you able to figure out what the underlying issue was @IvanovRoman?

Yes. I gave up storing the configuration in a webpack.config.js and transferred everything to a /.storybook/main.js.
Inside webpackFinal write your webpack config.

const path = require('path');
const webpack = require('webpack');

module.exports = {
  "stories": [
    "../src/**/*.stories.mdx",
    "../src/**/*.stories.@(js|jsx|ts|tsx)"
  ],
  "addons": [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-knobs",
  ],
  reactOptions: {
    fastRefresh: true
  },
  typescript: {
    check: false,
    checkOptions: {},
  },
  webpackFinal: async (config) => {
    config.module.rules.push({
      test: /\.tsx?$/,
      use: [
        {
          loader: 'ts-loader',
          options: {
            configFile: path.resolve(__dirname, '../tsconfig.build.json'),
            transpileOnly: true
          }
        }
      ]
    },
    {
      test: /\.ttf$/,
      use: [
        {
          loader: 'file-loader',
          options: {
            esModule: false
          }
        }
      ]
    },
    {
      test: /\.scss$/,
      use: [
        'style-loader',
        {
          loader: 'css-loader',
          options: {
            import: false,
            url: false
          }
        },
        'postcss-loader',
        'sass-loader']
    },
    {
      test: /\.scss$/,
      use: [
        {
          loader: 'css-loader',
          options: {
            modules: {
              compileType: "module",
              mode: "local",
              localIdentName: '[local]',
              exportLocalsConvention: "camelCaseOnly",
              exportOnlyLocals: true,
              namedExport: true
            },
            import: false,
            url: false
          }
        },
        'sass-loader'
      ]
    },
    {
      test: /\.css$/,
      use: ['style-loader', 'css-loader']
    },
    {
      test: /\.svg$/,
      use: 'null-loader'
    });

    config.plugins.push(
      new webpack.ProvidePlugin({
        Promise: 'bluebird'
      })
    );

    return config;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants