loki icon indicating copy to clipboard operation
loki copied to clipboard

Failing to load static file

Open adrianmsm opened this issue 4 years ago • 5 comments

Hi I'm trying to automate some loki tests using VueJs, and svg-sprite for svg's on build

The error I get is X With data → 1 request failed to load; file:///var/loki/static/media/[static file containing svg images here]

I can see the svg file in the folder storybook-static/static/media and the static version of storybook seems to work fine although when loki runs it's looking for the images in /var/loki. and returns the error unable to find them resulting in a failed test

I'm running this command for loki yarn build-storybook -c .storybook && yarn loki --requireReference --reactUri file:./storybook-static

adrianmsm avatar Sep 25 '20 13:09 adrianmsm

Could you please provide a link to repo with an example project where we can reproduce the issue?

techeverri avatar Sep 25 '20 13:09 techeverri

unfortunately not at the moment, its a private repo but i can try to make a new repo but not right away.

I'm just trying to find out what the path "file:///var/loki/" is coming from. I can see the image it says is missing in storybook-static/static/media and all the tests are running but just keep failing due to the missing svg

adrianmsm avatar Sep 25 '20 14:09 adrianmsm

Yeah. I'm having this issues as well but with external sources.

On a basic CRA, SB init + Loki set up I added a story for a video with the following src url https://www.w3schools.com/tags/movie.mp4 and it fails every time, even though it loads in storybook.

Updating this to https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4 seems to resolve the issue.

Now I'm having the issue with a video I can't remove. Can anyone see why just changing the link would have made the difference?

I have set up a delay using the suggested asyncCallback approach and the test fails before the delay even kicks in - guessing this means it failing to even get a byte of the file and it's some kind of network/environment/CORS issue.

d3vl1m3 avatar Aug 05 '22 09:08 d3vl1m3

I'm getting similar problems (I think), only when running with --reactUri set.

2023-02-25 11:02:36 [0225/100236.731702:INFO:CONSOLE(2)]
"Fetch API cannot load file:///var/loki/static/media/icon.8aeb5889.svg.
URL scheme "file" is not supported.", source: file:///var/loki/158.8744b91b.iframe.bundle.js (2)

Otherwise it works when running in docker with a Storybook server running, but also if I serve the static files from Storybook using http-server. I only get this error when trying to use --reactUri to tell Loki where the Storybook build files are located.

Flirre avatar Feb 25 '23 13:02 Flirre

Any solution for this issue ? I need --reactUri in my CI

Mata-wqq avatar Aug 17 '23 13:08 Mata-wqq