eduardoboucas / staticman

💪 User-generated content for Git-powered websites
https://staticman.net
MIT License
2.42k stars 541 forks source link

Error '{"success":false}' but no other information available #101

Closed oservieres closed 7 years ago

oservieres commented 7 years ago

Hi there,

First of all, this project is gorgeous ! Congrats for all your work, and for the effort of providing a hosted version.

But infortunately, I have a problem with the hosted version ;)

When I try to submit my comment, your server gives this response :

Status code : 400 Body : {"success":false}

staticman.yml :

comments:

  allowedFields: ["email", "name", "message"]

  branch: "comments"

  commitMessage: "Add comment to article"

  filename: "entry{@timestamp}"

  format: "yaml"

  generatedFields:
    date:
      type: date
      options:
        format: "timestamp-seconds"

  moderation: true

  name: "deudtens.com"

  path: "source/_comments/{options.slug}"

  requiredFields: ["email", "name", "message"]

  transforms:
    email: md5

Form HTML :

    <form method="POST" action="https://api.staticman.net/v2/entry/oservieres/blog-deudtens/comments/">
      <input name="options[redirect]" type="hidden" value="https://www.deudtens.com">
      <input name="options[slug]" type="hidden" value="{{ page.url }}">
      <label>Votre nom : <input name="fields[name]" type="text"></label>
      <label>Votre E-mail : <input name="fields[email]" type="email"></label>
      <label>Votre message : <textarea name="fields[message]"></textarea></label>

      <button type="submit">Envoyer</button>
    </form>

My blog repo : https://github.com/oservieres/blog-deudtens

I did not deploy the form in production, i'm submitting from my localhost.

I just don't understand what's happening, and I have no error message to guide me.

Do not hesitate to ask for more information if needed, Thank you.

eduardoboucas commented 7 years ago

I have just cloned your repository and tried running the site, but I'm getting a few build errors. Can you help?

192:blog-deudtens eduardoboucas$ jekyll serve
Configuration file: none
Configuration file: none
            Source: /Users/eduardoboucas/Sites/blog-deudtens
       Destination: /Users/eduardoboucas/Sites/blog-deudtens/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
             Error: could not read file /Users/eduardoboucas/Sites/blog-deudtens/source/_posts/2015-12-24-la-documentation-technique-redigee-en-anglais-seulement.md: (<unknown>): mapping values are not allowed in this context at line 2 column 35
             Error: could not read file /Users/eduardoboucas/Sites/blog-deudtens/source/_posts/2016-05-18-adapte-au-cinema-the-prestige.md: (<unknown>): mapping values are not allowed in this context at line 2 column 25
             Error: could not read file /Users/eduardoboucas/Sites/blog-deudtens/source/_posts/2016-05-31-adapte-au-cinema-i-am-legend.md: (<unknown>): mapping values are not allowed in this context at line 2 column 25
             Error: could not read file /Users/eduardoboucas/Sites/blog-deudtens/source/_posts/2016-08-18-mariage-photobooth.md: (<unknown>): mapping values are not allowed in this context at line 2 column 16
             Error: could not read file /Users/eduardoboucas/Sites/blog-deudtens/source/_posts/2017-02-08-adapte-au-cinema-arrival.md: (<unknown>): mapping values are not allowed in this context at line 2 column 25
     Build Warning: Layout 'default' requested in source/404.html does not exist.
     Build Warning: Layout 'default' requested in source/about.md does not exist.
    Liquid Warning: Liquid syntax error (line 6): Expected end_of_string but found open_round in "{{ site.calculated_date | date('c') }}" in source/atom.xml
    Liquid Warning: Liquid syntax error (line 15): Expected end_of_string but found pipe in "post in data.posts|slice(0, 10)" in source/atom.xml
    Liquid Warning: Liquid syntax error (line 19): Expected end_of_string but found open_round in "{{ post.date|date('c') }}" in source/atom.xml
  Liquid Exception: Liquid error (line 6): wrong number of arguments (given 1, expected 2) in source/atom.xml
jekyll 3.4.3 | Error:  Liquid error (line 6): wrong number of arguments (given 1, expected 2)
192:blog-deudtens eduardoboucas$ 
oservieres commented 7 years ago

Thank you for your attention ! But my website is powered by Sculpin, not Jekyll.

eduardoboucas commented 7 years ago

Oh, that explains it! Could you provide some installation instructions so I can get it running?

oservieres commented 7 years ago

I don't wanna bother you installing PHP and Sculpin. I'm not satisfied by the docker containers available either. Instead, I deployed the form on my website. See at the bottom of page : https://www.deudtens.com/deployez-en-production-des-le-debut-du-projet/

You can play with it as much as you want.

jonathanyeong commented 7 years ago

Firstly, thanks so much for building staticman. I'm actually getting the same issue on my site as well. It's running HTTPS (not sure if that makes a difference). I've added staticmanpp as a collaborator to my repo.

Here's the repo: https://github.com/jonathanyeong/personal-site.

staticman.yml:

comments:
  allowedFields: ["name", "email", "url", "message"]
  branch: "master"
  commitMessage: "Add Staticman data"
  filename: "entry{@timestamp}"
  format: "yaml"
  generatedFields:
    date:
      type: date
      options:
        format: "timestamp-seconds"
  moderation: true
  name: "jonathanyeong.com"
  path: "_data/comments/{options.slug}"
  requiredFields: ["name", "email", "message"]
  transforms:
    email: md5

my form (found in _layouts/post.html).

<form method="POST" action="https://api.staticman.net/v2/entry/jonathanyeong/personal-site/master/comments">
  <input name="options[redirect]" type="hidden" value="https://jonathanyeong.com">
  <!-- e.g. "2016-01-02-this-is-a-post" -->
  <input name="options[slug]" type="hidden" value="{{ page.slug }}">
  <label><input name="fields[name]" type="text">Name</label>
  <label><input name="fields[email]" type="email">E-mail</label>
  <label><textarea name="fields[message]"></textarea>Message</label>

  <button type="submit">Go!</button>
</form>

I am also submitting this form on localhost.

I doubt this makes a difference, but here's what I've tried doing:

Any suggestions?

eduardoboucas commented 7 years ago

A lot of people seem to be having these issues (see #108). I'm looking into this, please bare with me.

eduardoboucas commented 7 years ago

@jonathanyeong I can't find a staticman.yml file in your repo anymore, so I can't debug with your site.

eduardoboucas commented 7 years ago

Closing in favour of #108.

jonathanyeong commented 7 years ago

@eduardoboucas Apologies, I ended up removing staticman because it wasn't working. I went through the setup steps again and I ended up getting it working.

I was still getting the {'success': false} issue when I was running this back on my local host. However, when I pushed my changes it all worked on localhost (https://github.com/jonathanyeong/personal-site/pull/25).

I'm not sure if this information will help at all. Thank you for building this app!