question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better error handling for tech-docs when folder or mkdocs.yml is missing

See original GitHub issue

The better error-handling or messages there are the less confused users of backstage we’ll have. Right now when the folder docs or the file mkdocs.yml is missing or named mkdocs.yaml ot gets cryptic error messages like this one.

Failed to generate docs from /tmp/backstage-YEeOfY into /tmp/techdocs-tmp-t8WrEp with error undefined

Right now users seem to believe that this is due to backstage being buggy instead of having incorrect data in their repos. Most of these can be solved by some simple precondition-checks in the folder where the project is cloned to.

Expected Behavior

Missing docs folder:

Precondition:

fs.existsSync(docsFolder);

Message:

This project is missing the docs folder in the repository, you need to add it to be able to generate tech-docs

Missing mkdocs.yml:

Precondition

fs.existsSync('mkdocs.yml');

Message

The mkdocs.yml is missing in the root of this repository, making tech-docs unable to generate docs.

Incorrectly named mkdocs.yaml

Optionally it would be possible to rename mkdocs.yaml to mkdocs.yml in the cloned folder.

Precondition

!fs.existsSync('mkdocs.yml') && fs.existsSync('mkdocs.yaml'))

Message

The mkdocs.yaml file should be named mkdocs.yml in order to generate tech-docs for this project

Current Behavior

Errors like this are returned in the browser, while the message in the backend logs are a little better.

Failed to generate docs from /tmp/backstage-YEeOfY into /tmp/techdocs-tmp-t8WrEp with error undefined

Possible Solution

Use preconditions on folder before attempting to run mkdocs.

Context

Less confused users mean more and happy users!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
dtuitecommented, Feb 9, 2021

We have a user who was quite confused by this today so adding my +1.

The logs do have some extra information which is helpful, but it is not exposed to the user.

Could not read file /tmp/backstage-18z0vE/mkdocs.yml before running the generator. ENOENT: no such file or directory, open '/tmp/backstage-18z0vE/mkdocs.yml

I suggest that mkdocs.yaml is renamed to mkdoks.yml if the .yaml file exists and the .yml file doesn’t. In my mind it is commonly accepted that YAML files can end in either .yml or .yaml. The only error case should be if BOTH mkdocs.yaml and mkdocs.yml exist.

1reaction
soaprajcommented, Jun 15, 2021

For Beta release we should consider

  • supporting yaml and yml extensions
  • better error messages when the yaml file or the folder is missing
Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting TechDocs - Backstage.io
MkDocs Build Errors. Using the TechDocs CLI, you can troubleshoot MkDocs build issues locally. Note this requires you have Docker available to launch...
Read more >
Configuration - MkDocs
Project settings are configured by default using a YAML configuration file in the project directory named mkdocs.yml . You can specify another path...
Read more >
Backstage Unable to use mkdocs to create Tech Docs for an ...
Below is the workflow file written to create Md files. But "techdocs-cli generate --no-docker --verbose" command fails with the below error. Can ...
Read more >
mkdocs-techdocs-core - Python Package Health Analysis - Snyk
The core MkDocs plugin used by Backstage's TechDocs as a wrapper around multiple MkDocs plugins and Python Markdown extensions For more information about...
Read more >
squidfunk/mkdocs-material - Gitter
The best thing is just to extend the image and install your additional ... the issue: the error message says the file is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found