Skip to content

svelte-csf compatibility #176

@NeroBlackstone

Description

@NeroBlackstone

It seems that msw forced all requests to be proxied, and the browser reported an error:

[MSW] Uncaught exception in the request handler for "GET http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/axe-core.js?v=df0fc143":

TypeError: argument name is invalid
    at Object.serialize (http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/msw.js?v=b7ac9591:661:15)
    at getAllRequestCookies (http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/msw.js?v=b7ac9591:797:23)
    at HttpHandler.parse (http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/msw.js?v=b7ac9591:863:21)
    at HttpHandler.run (http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/chunk-4MCX7FAS.js?v=610418ab:106:37)
    at executeHandlers (http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/chunk-4MCX7FAS.js?v=610418ab:223:28)
    at http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/chunk-4MCX7FAS.js?v=610418ab:13040:12
    at until (http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/chunk-4MCX7FAS.js?v=610418ab:204:24)
    at handleRequest (http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/chunk-4MCX7FAS.js?v=610418ab:13039:30)
    at http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/msw-storybook-addon.js?v=df0fc143:1247:13
    at ServiceWorkerContainer.<anonymous> (http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/msw-storybook-addon.js?v=df0fc143:3671:15)

This exception has been gracefully handled as a 500 response, however, it's strongly recommended to resolve this error, as it indicates a mistake in your code. If you wish to mock an error response, please see this guide: https://mswjs.io/docs/http/mocking-responses/error-responses
error @ VM408 chunk-4MCX7FAS.js:344
(anonymous) @ VM398 msw-storybook-addon.js:1292
await in (anonymous)
(anonymous) @ VM398 msw-storybook-addon.js:3671
VM379 preview.mjs:6  GET http://localhost:6006/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/axe-core.js?v=df0fc143 net::ERR_ABORTED 500 (Request Handler Error)

I guess this is a svelte-scf compatibility issue? Because as soon as I delete the mock http endpoint in the svelte-scf story file, the error is gone:

delete:

    parameters: {
      msw: {
        handlers: [
          http.get("/api/button-click", () => {
            return HttpResponse.json({
              firstName: "Neil",
              lastName: "Maverick",
            });
          }),
        ],
      },
    },

Minimal reproduce:

https://stackblitz.com/~/github.com/NeroBlackstone/svelte-storybook-msw

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions