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

On failure to connect to GitHub, a MISSING_CONFIG_BLOCK error is thrown #328

Open
travisdowns opened this issue Feb 3, 2020 · 3 comments
Assignees
Labels

Comments

@travisdowns
Copy link

Let's say your github token is revoked or otherwise wrong. You should get a GITHUB_READING_FILE error or similar. In fact, due to incorrect error handling, you fall into the parsing validation code, which sees a null config block because the object isn't the file contents at all but an error object, and this gets transmuted to MISSING_CONFIG_BLOCK error w/o any useful details.

travisdowns added a commit to travisdowns/staticman that referenced this issue Feb 3, 2020
travisdowns added a commit to travisdowns/staticman that referenced this issue Feb 3, 2020
travisdowns added a commit to travisdowns/staticman that referenced this issue Feb 3, 2020
travisdowns added a commit to travisdowns/staticman that referenced this issue Feb 3, 2020
travisdowns added a commit to travisdowns/staticman that referenced this issue Feb 3, 2020
@alexwaibel alexwaibel self-assigned this Feb 11, 2020
@alexwaibel alexwaibel added the bug label Feb 24, 2020
@campus-ai-app
Copy link

campus-ai-app commented Feb 29, 2020

Hi, I'm receiving this error and I don't know if it's related to this bug (wrong token) or whether the configuration file is wrong.

I'm using the staticman.sample.yml file renamed to staticman.yml, v2 endpoints, and the github token is set in the config.production.json. The token corresponds to a valid token in an account that has push rights to the github pages repo.

What can I check to understand where is the problem?

My logs in Heroku when I start the app and try to do a post request are the following:

2020-02-29T14:59:17.059115+00:00 app[web.1]: > staticman@3.0.0 prestart /app
2020-02-29T14:59:17.059120+00:00 app[web.1]: > if [ ! -d node_modules ]; then npm install; fi
2020-02-29T14:59:17.059124+00:00 app[web.1]: 
2020-02-29T14:59:17.070471+00:00 app[web.1]: 
2020-02-29T14:59:17.070472+00:00 app[web.1]: > staticman@3.0.0 start /app
2020-02-29T14:59:17.070472+00:00 app[web.1]: > node index.js
2020-02-29T14:59:17.070472+00:00 app[web.1]: 
2020-02-29T14:59:18.123007+00:00 heroku[web.1]: State changed from starting to up
2020-02-29T14:59:18.090345+00:00 app[web.1]: Staticman API running on port 25924
2020-02-29T14:59:59.163691+00:00 heroku[router]: at=info method=POST path="/v2/entry/CampusAI/CampusAI.github.io/master/comments" host=campusai-staticman.herokuapp.com request_id=feec126f-555a-46df-a919-fa16e487f1af fwd="130.229.146.190" dyno=web.1 connect=1ms service=312ms status=500 bytes=495 protocol=https
2020-02-29T15:01:26.017205+00:00 heroku[router]: at=info method=POST path="/v2/entry/CampusAI/CampusAI.github.io/master/comments" host=campusai-staticman.herokuapp.com request_id=a3d31f0a-5c80-45ee-9b92-1c1de7193a72 fwd="130.229.146.190" dyno=web.1 connect=0ms service=226ms status=500 bytes=495 protocol=https

@travisdowns
Copy link
Author

In Heroku, I set the GitHub and RSA tokens via Heroku config variables, not via the config file (I use no config file at all).

I don't know if that's the problem though because in principle the config file should work too. There is some logging I think which indicates how the config was read.

I've fixed the error handling in my branch: you'll still get an error but it should tell you what actually went wrong.

@campus-ai-app
Copy link

Ok I'm sorry that was my bad: by setting the token in the configuration file GitHub was recognizing it and automatically invalidating it. Setting it in a Heroku variable solved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants