loki update: Cannot access the Story Store until the index is ready.
Just created a new SolidStart project from zero, added latest Storybook (8.3.5), tried to install and run Loki on it.
But when running the command npx loki update, this was the output:
loki update v0.35.0
(node:16608) NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode.
SDK releases are limited to address critical bug fixes and security issues only.
Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the blog post at https://a.co/cUPnyil
(Use `node --trace-warnings ...` to show where the warning was created)
FAIL chrome.app
Fetching stories
SB_PREVIEW_API_0011 (StoryStoreAccessedBeforeInitializationError): Cannot access the Story Store until the index is ready.
Some visual tests failed to run
Platform: Windows 10 Node v20.11.1
I have the same error when running loki in CI with github actions:
yarn loki --requireReference --reactUri file:./storybook-static --chromeConcurrency=1
PASS chrome.docker/PREPARE
Waiting for 127.0.0.1:10098.
Connected!
PASS chrome.docker/START
FAIL chrome.docker/FETCH_STORIES: SB_PREVIEW_API_0011 (StoryStoreAccessedBeforeInitializationError): Cannot access the Story Store until the index is ready.
FAIL chrome.docker: Some tasks failed to run
I looked at the code, and I suppose that the code that tests if a URL has been fully loaded is not working properly. If I increase the value of REQUEST_STABILIZATION_TIMEOUT to 5s I don't get the error anymore.
@ghusse, how to change it?
I did it with patch-package on my project to make it work.
Hello is there any updates on this? I have similar issue but this error 'loki update: Cannot access the Story Store until the index is ready' only shows in M1 macOs.
Hi!
I changed the REQUEST_STABILIZATION_TIMEOUT like you suggested @ghusse and it worked. However, it made my tests much slower. Any idea on how to adjust the fix to not slow down the tests?
diff --git a/src/commands/test/run-tests.js b/src/commands/test/run-tests.js
index 954460c8d2746d9f75648d59f8b214d83035378e..2eae0751e82c8264e7fac81942309e4aca6a0e89 100644
--- a/src/commands/test/run-tests.js
+++ b/src/commands/test/run-tests.js
@@ -127,7 +127,18 @@ async function runTests(flatConfigurations, options) {
type: TASK_TYPE_FETCH_STORIES,
},
task: async () => {
- storybook = await target.getStorybook();
+ while (true) {
+ try {
+ storybook = await target.getStorybook();
+ } catch (e) {
+ if (e.message.includes("until the index is ready")) {
+ await new Promise(r => setTimeout(r, 500));
+ continue;
+ }
+ throw e;
+ }
+ break;
+ }
if (storybook.length === 0 && !options.passWithNoStories) {
throw new Error('Error: No stories were found.');
}
I'm using this patch on @loki/runner, and 🤞 it's fixed our issues