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

Verified https call to be correct but still getting GITHUB_WRITING_FILE #134

Open
hxiongg opened this issue Sep 20, 2017 · 12 comments

Comments

@hxiongg
Copy link

commented Sep 20, 2017

I am still using the V1 version.

I did a POST to the following
https://api.staticman.net/v1/entry/Huixiong91/my-blog/master

fields[message]:test1
fields[name]:testname
fields[email]:test@somemail.com

Getting back with status code 500
{ "success": false, "errorCode": "GITHUB_WRITING_FILE" }

I have added staticman to collaborator and pinged it using via https://api.staticman.net/v1/connect/Huixiong91/my-blog

Somehow staticman managed to create a branch in my repo but with nothing new added.

@petzi53

This comment has been minimized.

Copy link

commented Sep 23, 2017

I get same problem error message as @Huixiong91 with V2. After sending the discussion message my browser changes to https://api.staticman.net/v2/entry/petzi53/weblog2/master/comments which I believe is correct. The manual inspection of my repo at GitHub shows that there is a difference in the URL adding tree bevor master. https://api.staticman.net/v2/entry/petzi53/weblog2/tree/master/comments . But I tried it with this URL too and got another message which I always get if a wrong URL is given.

`Cannot POST /v2/entry/petzi53/weblog2/tree/master/comments``

So I believe the first URL is the correct one, but I got the same error message as @Huixiong91.

{"success":false,"errorCode":"GITHUB_WRITING_FILE"}

I tried it with and without moderation.

What could be the problem?

I am not using Jekill but Hugo and Blogdown. So maybe there is some code to change which is specific for Jekill. Unfortunately, I am a newcomer to Hugo and have no idea about Jekill. So I cannot say which lines I have to change. Maybe you could give me a hint where to look?

@eduardoboucas

This comment has been minimized.

Copy link
Owner

commented Sep 23, 2017

@Huixiong91 I can't find a my-blog repo under your account in order to investigate – perhaps it's a private repo?

@petzi53 The first URL is indeed the correct one. Have you used the /connect endpoint to establish a connection between Staticman and your repo? Do you see staticmanapp as a collaborator of your repository?

@hxiongg

This comment has been minimized.

Copy link
Author

commented Sep 23, 2017

@eduardoboucas
Yes, indeed it's a private repo, do you not support that?

@eduardoboucas

This comment has been minimized.

Copy link
Owner

commented Sep 23, 2017

@Huixiong91 Private repos are supported, it just means I can't look at your config to find potential issues. Do you have a staticman.yml file? If so, can you copy its contents and paste them here in order to look for YAML validation errors?

@hxiongg

This comment has been minimized.

Copy link
Author

commented Sep 23, 2017

@eduardoboucas Since I am still using V1. I had the following inside _config.yml instead.

staticman: 
  allowedFields: 
    - name
    - email
    - url
    - message
  branch: master
  commitMessage: "New comment."
  filename: "comment-{@timestamp}"
  format: yml
  generatedFields: 
    date: 
      options: 
        format: iso8601
      type: date
  moderation: true
  path: "/_data/comments/{options.slug}"
  requiredFields: 
    - name
    - email
    - message
  transforms: 
    email: md5
@hxiongg

This comment has been minimized.

Copy link
Author

commented Sep 23, 2017

@eduardoboucas I have made the repo public for easier viewing https://github.com/Huixiong91/my-blog

@petzi53

This comment has been minimized.

Copy link

commented Sep 23, 2017

@eduardoboucas Yes, I see staticmanapp as a collaborator on my repo.

@petzi53

This comment has been minimized.

Copy link

commented Sep 29, 2017

In the meanwhile, I have tried several variants. I tried it with a Jekyll site and then I discovered that there is also a test Hugo site which is the site generator I am using. But unfortunately, after forking and cloning this test site, I could not manage it to deploy it with Netlify. And the Jekill test site did not work either…

So I stay where I was before. The only difference is now that my error message changed to:
Cannot POST /v2/entry/petzi53/test-staticman/master/content/post

@eduardoboucas Help would be very much appreciated. My test site for staticman is at https://github.com/petzi53/test-staticman/ and live at https://test-staticman.netlify.com/

[I cloned my production weblog to a test site so that I can continue to work on my weblog and still my last attempt in testing staticman is available (frozen).]

@looeee

This comment has been minimized.

Copy link

commented Dec 27, 2017

In case anybody else comes across this, I suddenly started get this error while developing on localhost.
No changes to the configuration file, everything working fine then suddenly "GITHUB_WRITING_FILE".

The only difference I could find is that my remote repo was no longer in sync with my local one. I did a "git pull" and everything started working again.

Seems a bit voodoo-ish, since I'm not sure why this would make a difference, but I've tested this a few more times and it seems like sometimes when the repos are out of sync, this error pops up, and a "git pull" always fixes it.

@slowbreathing

This comment has been minimized.

Copy link

commented Jul 27, 2019

slowbreathing.github.com, i have the same problem. Just doesnt work. staticman v3. i have leonids theme.

@slowbreathing

This comment has been minimized.

Copy link

commented Jul 27, 2019

@Jimeh87

This comment has been minimized.

Copy link

commented Aug 30, 2019

For anyone running into this issue now I had to add repo -> public_repo as a scope to the personal access token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.