-
Notifications
You must be signed in to change notification settings - Fork 39
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
Service Worker script does not exist at the given path #77
Comments
Hey, @fhavrlent. Just to clarify, do you confirm that the worker script is accessible via this URL?
Even if it is, I think it won't be able to register at the |
Hello @kettanaito , yes, the script is accessible via that URL + the storybook is placed in the same folder, so intercepting requests should not be an issue. At least I have no way to test it since it is acting like there is no worker script at all. |
Double-checking is your Storybook also running on I would kindly ask you to provide a reproduction repository around this. Or, at least, share a public URL of your deployed Storybook, maybe I would be able to understand what's going on in runtime. |
So, I kinda have the same problem. My application: https://guissimatheus.github.io/design-system-react If you go to the browser network tab, you can see the msw get request url https://guissimatheus.github.io/mockServiceWorker.js with status code 404. I can access the worker file at https://guissimatheus.github.io/design-system-react/mockServiceWorker.js I dunno how I can config my project to change the url and get the mock to work on GitHub. |
Just ran into this as well. Work around is to tell MSW where to look for the file. One gotcha is you'll likely want to have it be different for github pages vs running locally. // preview.js
let options = {};
if (location.hostname === "username.github.io") {
options = {
serviceWorker: {
url: "/repo-name/mockServiceWorker.js",
},
};
}
initialize(options); https://msw-sb.vercel.app/?path=/story/guides-getting-started--page#configuring-msw |
I tried to deploy in chromatic with next script and have the next problem
In local i have the next script How put to deploy that take the msw? |
@santilp95, can you please check if your Storybook build command also has the |
@kettanaito yes, it work It works, I had to change the build, thank you very much
|
@fhavrlent, could you please try @WesleyKapow's suggestion and let me know? I believe it should resolve your issue. |
Hey, what about |
Hello, we have a storybook running in a subdirectories (for PRs and also one stable version). Msw was not working out of the box for this setup, but then I used #75 setup.
Issues is, we are still getting an error that file does not exist in the path. But when I click on the link in the error message, I am taken to
mockServiceWorker.js
, so it obliviously exist in the location.We are using React with CRA and latest version of storybook.
Is anyone able to help with this, please? I have no clue at this point what might be the issue.
The text was updated successfully, but these errors were encountered: