Skip to content
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

[BUG] Malformed YAML content produced by "Export Config" #482

Closed
4 tasks done
octagons opened this issue Feb 8, 2022 · 1 comment
Closed
4 tasks done

[BUG] Malformed YAML content produced by "Export Config" #482

octagons opened this issue Feb 8, 2022 · 1 comment
Assignees
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working

Comments

@octagons
Copy link

octagons commented Feb 8, 2022

Environment

Self-Hosted (Docker)

Version

2.0.2

Describe the problem

When I export the configuration from the "View / Export Config" modal in the config menu on the web interface, the content sent by the application when I click "Download as File" has a leading space (i.e. 0x20) on the first column, first line of the file.

If I try to place this file at public/conf.yml without appropriate inspection (yes, I know), the build will fail because it fails to appropriately parse the section indentations from the YAML configuration.

Additional info

I am deploying Dashy from a custom template saved in Portainer. My compose file is below:

---
version: "3.8"
services:
  dashy:
    container_name: Dashy
    image: lissy93/dashy:latest
    volumes:
      - dashy:/app
    ports:
      - 4000:80
    environment:
      - NODE_ENV=production
    restart: unless-stopped
    healthcheck:
      test: ['CMD', 'node', '/app/services/healthcheck']
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
volumes:
  dashy:
    name: dashy

The linter (i.e. yarn validate-config) produces a decent, but somewhat indirect error:

/app/public # yarn validate-config
yarn run v1.22.5
$ node services/config-validator

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Error, unable to validate 'conf.yml' 
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━


Please ensure that your config file is present, has the correct access rights and is parsable. If this warning persists, it may be an issue with the validator function. Please raise an issue, and include the following stack trace:

Stack Trace for config-validator.js:
 YAMLException: end of the stream or a document separator is expected (40:1)

 37 |   disableUpdateChecks: false
 38 |   disableSmartSort: false
 39 |   enableErrorReporting: false
 40 | pageInfo:
------^
 41 |   title: Dashy
 42 |   description: Welcome to your  ...
    at generateError (/app/node_modules/js-yaml/lib/loader.js:183:10)
    at throwError (/app/node_modules/js-yaml/lib/loader.js:187:9)
    at readDocument (/app/node_modules/js-yaml/lib/loader.js:1645:5)
    at loadDocuments (/app/node_modules/js-yaml/lib/loader.js:1688:5)
    at Object.load (/app/node_modules/js-yaml/lib/loader.js:1714:19)
    at Object.<anonymous> (/app/services/config-validator.js:64:23)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12) {
  reason: 'end of the stream or a document separator is expected',
  mark: {
    name: null,
    buffer: ' appConfig:\n' +
      '  theme: one-dark\n' +
< snip >

Please tick the boxes

@octagons octagons added the 🐛 Bug [ISSUE] Ticket describing something that isn't working label Feb 8, 2022
Lissy93 added a commit that referenced this issue Feb 9, 2022
RIP my hand written YAML parser, you served me well. Replaced with the js-yaml node package
@Lissy93
Copy link
Owner

Lissy93 commented Feb 14, 2022

This should be fixed now, I've replaced my own JSON to YAML parser with the js-yaml module in #488 (released in V2.0.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working
Projects
None yet
Development

No branches or pull requests

2 participants