Staticman Repo Setup Errors

Common Staticman Config Erorrs in Git repos

Background

Idem to Staticman on Framagit.

Besides, the build time for my Staticman + Beautiful Hugo demo on Framagit is half of that for the same project on GitLab.com.

Problem

After the setup, it’s possible that the theme shows “Sorry! There’s an error during submission.” To get an insight into this error, one has to open Web Developer ToolsNetwork and select the row corresponding to the POST request sent to the Staticman API. A side pane will pop out on the right. Select Response to view the API’s response in JSON.

  • Missing required fields: the “missing fields” error will occur.

  • In case of an incorrect GIT***_TOKEN on the server-side, or that the associated GitHub/GitLab account has not been invited as a “Collaborator/Developer”, the API will respond with an “unauthorized” error.

  • In case of incorrect scopes of the GIT***_TOKEN on the server-side, the API will repond with a 404 error GITHUB_CREATING_PR.

    {
      "JSON": {
        "success": false,
        "rawError": {
          "message": "{\"message\":\"Not Found\",\"documentation_url\":\"https:\/\/developer.github.com\/v3\/git\/refs\/#create-a-reference\"}",
          "statusCode": 404
        },
        "errorCode": "GITHUB_CREATING_PR"
      },
      "Response payload": {
        "EDITOR_CONFIG": {
          "text": "{\"success\":false,\"rawError\":{\"message\":\"{\\\"message\\\":\\\"Not Found\\\",\\\"documentation_url\\\":\\\"https:\/\/developer.github.com\/v3\/git\/refs\/#create-a-reference\\\"}\",\"statusCode\":404},\"errorCode\":\"GITHUB_CREATING_PR\"}",
          "mode": "application\/json"
        }
      }
    }
    
  • In case of an incorrect user/repo name, a 404 error will be observed on the left of the entry in Web Developer ToolsNetwork.

  • In case of an incorrect branch/property name, a “read file” error will be thrown.

  • If the branch parameter in staticman.yml doesn’t match that one specified in the POST URL, a “branch mismatch” error will occur.

  • The most difficult case is “500: Internal server error” with {"success": false}. This gives no information about what’s going wrong. After two days of experiments with staticman.yml while setting up Staticman-powered GitLab Pages on Framagit, I have discovered several possible causes for such error. They are all due to incorrect config parameters in staticman.yml.

    • allowedFields doesn’t match the name of the input fields in the POST request. (i.e. blog theme template)
    • incorrect reCaptcha parameters: if enabled is set to false, one has to empty the siteKey and secret with the empty string "". One can’t directly start a newline after the colon :.

    While testing for my new public Staticman instance for Framagit, I had forgotten that my another instance for GitLab.com was using a different private RSA key for the encryption endpoint.Therefore, the reCaptcha secret copied from my demo repos on GitLab.com would not work.


4 comments

Your email address will not be published. Required fields are marked *.