Skip to content

Type error if apiPath is a list #16

@HiPhish

Description

@HiPhish

Describe the bug

According to the documentation the apiPath passed to createDjangoAPIMiddleware is a list of strings, but this raises a type error: e.split is not a function. I don't know much about server-side JavaScript, but I guess that the error is in that router.use expects a string, not a list.

After changing apiPath to a string storybook starts fine. I have not yet gotten around to adding a Django story though.

Which terms did you search for in the documentation and issue tracker?

  • "type error"

Steps to reproduce

(Write your steps here:)

  1. Set up a Django project with working django-pattern-library integration
  2. Add storybook to the project and confirm that it works (npm run storybook)
  3. Add storybook-django to the project (according to package-lock.json I have version 1.0.0 installed)
  4. Configure the middleware according to the documentation
  5. Run npm run storybook

Expected behavior

Storybook should start with apiPath as a list.

Actual behavior

The type error was raised.

$ npm run storybook

> my-project@0.0.0 storybook
> storybook dev -p 6006

storybook v9.0.8

[HPM] Proxy created: /  -> http://localhost:8000
TypeError: e.split is not a function
    at parse (./node_modules/storybook/dist/core-server/index.cjs:35926:41)
    at e.use (./node_modules/storybook/dist/core-server/index.cjs:35961:63)
    at e.use (./node_modules/storybook/dist/core-server/index.cjs:36001:135)
    at middleware (./node_modules/storybook-django/src/middleware.js:24:12)
    at storybookDevServer (./node_modules/storybook/dist/core-server/index.cjs:36738
    at async buildOrThrow (./node_modules/storybook/dist/core-server/index.cjs:35372
    at async buildDevStandalone (./node_modules/storybook/dist/core-server/index.cjs
    at async withTelemetry (./node_modules/storybook/dist/core-server/index.cjs:3612
    at async dev (./node_modules/storybook/dist/cli/bin/index.cjs:5906:3)
    at async s.<anonymous> (./node_modules/storybook/dist/cli/bin/index.cjs:6084:74)

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions