Skip to content

Attempt to fix 'JSON5: invalid end of input' build error in CI#1960

Merged
matyasf merged 1 commit intomasterfrom
fixing_JSON_CI_ERROR
May 8, 2025
Merged

Attempt to fix 'JSON5: invalid end of input' build error in CI#1960
matyasf merged 1 commit intomasterfrom
fixing_JSON_CI_ERROR

Conversation

@matyasf
Copy link
Collaborator

@matyasf matyasf commented May 5, 2025

The debug statements help to investigate flaky CI builds that fail.
Also remove fse, since the error seems to be that styleDictionarySource is not created in some cases

Trying to fix errors like

scss
✔︎ /home/runner/work/instructure-ui/instructure-ui/packages/canvas-high-contrast-theme/tokens/scss/_variables.scss

scss
✔︎ /home/runner/work/instructure-ui/instructure-ui/packages/canvas-theme/tokens/scss/_variables.scss

scss
✔︎ /home/runner/work/instructure-ui/instructure-ui/packages/ui-theme-tokens/tokens/canvas/scss/_variables.scss

scss
✔︎ /home/runner/work/instructure-ui/instructure-ui/packages/ui-themes/tokens/canvas/scss/_variables.scss
/home/runner/work/instructure-ui/instructure-ui/node_modules/json5/lib/parse.js:1110
    const err = new SyntaxError(message)
                ^

SyntaxError: Failed to load or parse JSON or JS Object: JSON5: invalid end of input at 1:1
    at syntaxError (/home/runner/work/instructure-ui/instructure-ui/node_modules/json5/lib/parse.js:1110:17)
    at invalidEOF (/home/runner/work/instructure-ui/instructure-ui/node_modules/json5/lib/parse.js:1059:12)
    at Object.start (/home/runner/work/instructure-ui/instructure-ui/node_modules/json5/lib/parse.js:843:19)
    at Object.parse (/home/runner/work/instructure-ui/instructure-ui/node_modules/json5/lib/parse.js:32:32)
    at combineJSON (file:///home/runner/work/instructure-ui/instructure-ui/node_modules/style-dictionary/lib/utils/combineJSON.js:111:32)
    at StyleDictionary.extend (file:///home/runner/work/instructure-ui/instructure-ui/node_modules/style-dictionary/lib/StyleDictionary.js:302:28) {
  lineNumber: 1,
  columnNumber: 1
}

Node.js v22.15.0
node:child_process:957
    throw err;
    ^

Error: Command failed: npm run build:tokens
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:882:11)
    at execSync (node:child_process:954:15)
    at ChildProcess.<anonymous> (/home/runner/work/instructure-ui/instructure-ui/scripts/bootstrap.js:67:20)
    at ChildProcess.emit (node:events:518:28)
    at ChildProcess._handle.onexit (node:internal/child_process:293:12) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 9206,
  stdout: null,
  stderr: null
}

Node.js v22.15.0

@matyasf matyasf self-assigned this May 5, 2025
@github-actions
Copy link

github-actions bot commented May 5, 2025

PR Preview Action v1.6.1
Preview removed because the pull request was closed.
2025-05-08 16:01 UTC

The debug statements help to investigate flaky CI builds that fail with "JSON5: invalid end of input
at 1:1"
Also remove 'fse', since the erro seems to be that 'styleDictionarySource' is not created  in some
cases
@matyasf matyasf force-pushed the fixing_JSON_CI_ERROR branch from 18e8665 to ac6f1e8 Compare May 7, 2025 15:15
Comment on lines -35 to -36
return fse
.outputFile(sourcePath, JSON.stringify(styleDictionarySource))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error was likely that this was not created in some rare cases, I dont know why. I've replaced it with just native Node code

@matyasf matyasf changed the title WIP trying to fix JSON build error in CI Attempt to fix'JSON5: invalid end of input' build error in CI May 7, 2025
@matyasf matyasf changed the title Attempt to fix'JSON5: invalid end of input' build error in CI Attempt to fix 'JSON5: invalid end of input' build error in CI May 7, 2025
@matyasf matyasf requested review from balzss and joyenjoyer May 7, 2025 15:18
Copy link
Contributor

@balzss balzss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't even know why a 3rd party lib was used in the first place. Good find!

@matyasf matyasf merged commit 904244a into master May 8, 2025
8 checks passed
@matyasf matyasf deleted the fixing_JSON_CI_ERROR branch May 8, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants