storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.14k stars 9.25k forks source link

SB 6.4.19 - TypeError: render is undefined - after sb upgrade #17774

Open webketje opened 2 years ago

webketje commented 2 years ago

Describe the bug After following the guide at https://storybook.js.org/docs/vue/configure/upgrading and manually upgrading some other dependencies, a runtime error occurs when the webview is loaded. Impact: the SB frame and widgets are there, but no story can be loaded. The error occurs both on production & dev builds. I tried tracking the error in the source code, but it is too cryptic without knowing most or all of it.

TypeError: render is undefined
    prepareStory prepareStory.js:89
    memoizerific memoizerific.js:170
    storyFromCSFFile StoryStore.js:328
    pnpm vendors~main.iframe.bundle.js:14113
    getStoryIndex StoryStoreFacade.js:98
    getStoryIndex ClientApi.js:402
    getStoryIndex start.js:150
    promise vendors~main.iframe.bundle.js:95643
    _runResolutions index.js:214
    then index.js:67
    initializeWithProjectAnnotations PreviewWeb.js:175
    pnpm vendors~main.iframe.bundle.js:26985
    promise vendors~main.iframe.bundle.js:95643
    _runResolutions index.js:214
    then index.js:67
    initialize PreviewWeb.js:119
    configure start.js:148
    configure index.js:22
    js generated-stories-entry.js:6
    js main.iframe.bundle.js:17701
    Webpack 7
[index.js:56](webpack:///node_modules/.pnpm/@storybook+client-logger@6.4.19/node_modules/@storybook/client-logger/dist/esm/index.js)
    error index.js:56
    renderPreviewEntryError PreviewWeb.js:1419
    initializeWithProjectAnnotations PreviewWeb.js:181
    _runRejections index.js:194
    _runRejections index.js:191
    catch index.js:79
    initializeWithProjectAnnotations PreviewWeb.js:180
    initialize PreviewWeb.js:120
    _runResolutions index.js:217
    _runResolutions index.js:214
    then index.js:67
    initialize PreviewWeb.js:119
    configure start.js:148
    configure index.js:22
    js generated-stories-entry.js:6
    js main.iframe.bundle.js:17701

To Reproduce Due to the repo being private & the cause of the issue unknown, the only thing I could say to reproduce it is to upgrade a Storybook from 6.0 to 6.4.19. I've followed all the directions at https://github.com/storybookjs/storybook/blob/next/MIGRATION.md, tweaked various params but to no avail. The error persists.

System

  System:
    OS: Windows 10 10.0.19041
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  Binaries:
    Node: 16.13.2 - ~\.nvm\versions\node\v16.13.2\bin\node.EXE
    npm: 8.1.2 - ~\.nvm\versions\node\v16.13.2\bin\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.46)
  npmPackages:
    @storybook/addon-a11y: 6.4.19 => 6.4.19
    @storybook/addon-actions: 6.4.19 => 6.4.19
    @storybook/addon-controls: 6.4.19 => 6.4.19
    @storybook/addon-docs: 6.4.19 => 6.4.19
    @storybook/addon-essentials: ^6.4.19 => 6.4.19
    @storybook/addon-storysource: 6.4.19 => 6.4.19
    @storybook/addon-viewport: 6.4.19 => 6.4.19
    @storybook/addons: 6.4.19 => 6.4.19
    @storybook/vue: 6.4.19 => 6.4.19

Note: only addon-essentials & addon-a11y are used in the actual SB build Additional context

webketje commented 2 years ago

Manually upgraded to 6.3.13 and everything worked out-of-the-box. So this is very probably an issue with 6.4.x

newt-beach commented 2 years ago

Encountering this on 6.5.9 for Ember, on a fresh install.

josj01 commented 1 year ago

For anyone else who might encounter this - you can get TypeError: render is undefined when exporting inside your stories.

A simple typo that took way too long to fix.

on 6.5.14

// component.stories.ts

export const EXAMPLE_IMAGES = [
^ 
this will cause "render is undefined"

  ...

];

export default {
  title: ...,
  argTypes: {
   images: {
      ...
      options: EXAMPLE_IMAGES,