Describe the bug
I am trying to add Storybook middleware to my web server. When upgrading to 5.0.x and making some necessary adjustments, the Storybook build and standalone server work, but I am receiving an error trying to create the middleware.
To Reproduce
This is the helper function I'm using to obtain the Storybook router.
// @flow
// middleware.js
import storybook from '@storybook/core/dist/server/dev-server'
import path from 'path'
export default function createStorybookMiddleware () {
const configDir = path.resolve(__dirname, 'src')
return storybook({
configDir,
output: { publicPath: '/storybook/' },
publicPath: '/storybook/',
ignorePreview: true,
debugWebpack: true
})
}
Expected behavior
I would expect that I am able to get a reference to the router and use it in my web server.
Screenshots

System:
It could possibly be connected with wrong "latest" tag on npm release. I think it is erroneously set to 3.4.12 instead of 5.0.4
Thanks for the heads up! I'll take a look at my lockfile to see if there's anything older pulled in by accident :female_detective:!
I upgraded to v5.0.5 and can confirm from my lockfile that all the dependencies are also on v5.0.5. Still receiving Error: Manager build is broken with { error: null }.
@ndelangen Any known changes to middleware in 5.0?
Would appear I was actually missing some Storybook packages. After adding everything there was a small error for the preview build. This is the setup I have now that's working:
// @flow
// middleware.js
import storybook from '@storybook/core/dist/server/dev-server'
import path from 'path'
export default function createStorybookMiddleware () {
const configDir = path.resolve(__dirname, 'src')
return storybook({
configDir,
output: { publicPath: '/storybook/' },
publicPath: '/storybook/',
packageJson: require('./package.json')
})
}
Most helpful comment
Would appear I was actually missing some Storybook packages. After adding everything there was a small error for the preview build. This is the setup I have now that's working: