chromaui/chromatic-cli

Chromatic + Github Actions doesn't work. Logs say Sentinel file 'files-copied.txt' not OK.

Closed this issue · 16 comments

Bug report
When I run chromatic build through github actions chromaui/action@v10, it returns the following error:

(...)
Publish your built Storybook
    → Validating Storybook files
Publishing your built Storybook
    → Calculating file hashes
Publishing your built Storybook
    → Starting publish
    → [====================] 100%
Publishing your built Storybook
    → Finalizing upload
    → Sentinel file 'files-copied.txt' not OK.

✖ Failed to publish your built Storybook
Sentinel file 'files-copied.txt' not OK.
→ View the full stacktrace below

If you need help, please chat with us at https://www.chromatic.com/docs/cli for the fastest response.
You can also email the team at support@chromatic.com if chat is not an option.

Please provide us with the above CLI output and the following info:
{
  "timestamp": "2024-02-01T15:33:46.064Z",
  "sessionId": "7e77c4f1-c57d-41b1-addb-2fdc6a498bf0",
  "gitVersion": "2.43.0",
  "nodePlatform": "linux",
  "nodeVersion": "20.8.1",
  "packageManager": "yarn",
  "packageManagerVersion": "1.22.21",
  "packageName": "chromatic",
  "packageVersion": "10.6.1",
  "storybook": {
    "viewLayer": "react",
    "version": "7.6.12"
  },
  "flags": {
    "allowConsoleErrors": false,
    "exitOnceUploaded": false,
    "exitZeroOnChanges": true,
    "interactive": false,
    "uploadMetadata": false,
    "zip": false
  },
  "configuration": {},
  "buildScript": "storybook build",
  "buildCommand": "yarn run build-storybook --output-dir /tmp/chromatic--1938-9F4vSasTkbFa",
  "exitCode": 0,
  "exitCodeKey": "OK",
  "errorType": "Error",
  "errorMessage": "✖ Failed to publish your built Storybook",
  "build": {
    "id": "65bbb97db81ede0ebf445948",
    "number": 1123
  }
}

Error: ✖ Failed to publish your built Storybook
Sentinel file 'files-copied.txt' not OK.
    at Kqt.retries (/home/runner/work/_actions/chromaui/action/v10/action/register.js:1363:59167)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async wyi (/home/runner/work/_actions/chromaui/action/v10/action/register.js:1371:1111)
    at async KX.task (/home/runner/work/_actions/chromaui/action/v10/action/register.js:636:24188)
Error: non-zero exit code

When I run chromatic locally, it builds successfully.

✔ Storybook published
We found 89 components with 231 stories.
ℹ View your Storybook at https://[ommited].chromatic.com/

I can't find this files-copied.txt that Sentinel says is not OK.

I faced the same issue.. T_T

@moeyashi I'm sorry for my noob -ness, but what is a self-hosted-runner? I'm doing all of this in GitHub Actions.

@angelod1as Sorry, It seems like it was my fault

@moeyashi what did you do to fix it?

@angelod1as It's not fixed yet

We're having the same issue. It sounds absolutely mad to say it out loud, but it definitively only happens on our odd numbered builds. Even numbered builds always work just fine. It's a pattern we've noticed, can anyone at @chromatic-support comment? We're having to retry jobs every day (every other job anyway).

The working theory that we have for this is that it affects odd numbered builds only. As of a week ago, odd numbered builds fail consistently but even numbered builds get through. I've reached out to Chromatic support

image001

We are having the same issue. It seems to happen to us each time we push changes to a PR that has already successfully run the chromatic CI step once. Manually re-running the failed action seems to work every time. I reached out to Chromatic support, and they suggested passing the --no-file-hashing flag, however it doesn't look like that is supported by the action yet.

Thanks all for chiming in. The fileHashing option was overlooked for the action, I'll get that added ASAP (PR here). Once that's in you'll be able to set fileHashing: false as an option.

Meanwhile, if you chat with support, they can disable the feature for your account altogether. Not recommended though because hashing enables us to skip uploading files that have been uploaded before, which speeds up your CI job significantly (saving you money in the process).

The reason for the odd/even build failures is that the deduplication mechanism will delete file hash records if anything goes wrong, which means the next build will not dedupe anything because we won't have any records. However, the next build then will attempt to dedupe again, which fails. I'm still looking into the reason for those failures.

I've released v10.9.1 which adds the fileHashing option to our GitHub Action.

@ghengeveld thank you very much!

I'm kind of stupid for GH actions, so where would I add this setting?

      - name: Publish to Chromatic
        id: chromatic-deploy
        uses: chromaui/action@v10
        with:
          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

@angelod1as you can try something like this:

       - name: Publish to Chromatic
        id: chromatic-deploy
        uses: chromaui/action@v10
        with:
          fileHashing: false
          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

@angelod1as @dspachos @adamth @wherehows @henricook @moeyashi We've found and fixed a problem with the file copying. We weren't properly URL-encoding filenames, which caused the copy to fail for files that contained "unsafe" characters such as ä or +. Now that this has been fixed, please give file hashing another try and let me know if the problem has been resolved for you. No CLI / GitHub Action update is necessary, just remove fileHashing: false / --no-file-hashing from your config.

Looks good to us so far, thanks @ghengeveld - we've re-enabled file hashing and haven't seen the problem again.

@ghengeveld I'm still having the issue whereas using Chromatic v10.9.6.

Publishing your built Storybook
    → Finalizing upload
    → Sentinel file 'files-copied.252920355.txt' not present.

✖ Failed to publish your built Storybook
Sentinel file 'files-copied.252920355.txt' not present.
→ View the full stacktrace below

If you need help, please chat with us at https://www.chromatic.com/docs/cli for the fastest response.
You can also email the team at support@chromatic.com if chat is not an option.

I don't use the GitHub Actions, I just run my npm script:
chromatic --build-script-name build:storybook:command --auto-accept-changes --exit-zero-on-changes --only-changed --externals \"public/**\"

Any idea what could cause the issue?

EDIT: note it does not happen all the time, and locally it seems it never makes since issue

EDIT2: I do understand I could use --no-file-hashing but from what I understand I would loose the benefit of some caching. Which is not ideal ^^

@sneko Sorry for the delay. Were you able to resolve the issue? If not I advise you to use our in-app chat or email support to take a closer look at your situation. File hashing is working correctly for other customers now.