decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.8k stars 3.03k forks source link

Git Gateway Error when logging in #3408

Closed BranonConor closed 4 years ago

BranonConor commented 4 years ago

Describe the bug When logging in to /admin using Google for an account that has been invited and has been working for weeks, I get two "Git Gateway Error {object Object}" error notifications. No changes have been made to the admin _config.yml that should affect this.

To Reproduce Go to admin log in > click log in > sign in with google > pick email > get error, and can't log in > clear cache and try again > same error

Expected behavior allow log in

Applicable Versions:

CMS configuration

backend:
    name: git-gateway
    branch: master

# This line should *not* be indented
publish_mode: editorial_workflow

# These lines should *not* be indented
media_folder: "/images/uploads" # Media files will be stored in the repo under static/images/uploads
public_folder: "/images/uploads" # The src attribute for uploaded media will begin with /images/uploads

collections:
  - name: "blog" # Used in routes, e.g., /admin/collections/blog
    label: "Blog" # Used in the UI
    folder: "source/_posts/blog" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
    fields: # The fields for each document, usually in front matter
      - {label: "Layout", name: "layout", widget: "hidden", default: "blog"}
      - {label: "Draft", name: "draft", widget: "boolean", default: true}
      - {label: "Type", name: "type", widget: "hidden", default: "blog"}
      - {label: "Excerpt", name: "excerpt", widget: "string"}
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Publish Date", name: "date", widget: "datetime"}
      - {label: "Featured Image", name: "thumbnail", widget: "image", required: false}
      - {label: "Body", name: "body", widget: "markdown"}
      - {label: "Categories", name: "categories", widget: "string"}
      - {label: "Tags", name: "tags", widget: "string"}
  - name: "components" # Used in routes, e.g., /admin/collections/blog
    label: "Component" # Used in the UI
    folder: "source/_posts/components" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
    fields: # The fields for each document, usually in front matter
      - {label: "Layout", name: "layout", widget: "hidden", default: "blog"}
      - {label: "Draft", name: "draft", widget: "boolean", default: true}
      - {label: "Type", name: "type", widget: "hidden", default: "component"}
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Publish Date", name: "date", widget: "datetime"}
      - {label: "Featured Image", name: "thumbnail", widget: "image", required: false}
      - {label: "Body", name: "body", widget: "markdown"}
  - name: "quotes" # Used in routes, e.g., /admin/collections/blog
    label: "Testimonial Quotes" # Used in the UI
    folder: "source/_posts/quotes" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
    fields: # The fields for each document, usually in front matter
      - {label: "Draft", name: "draft", widget: "boolean", default: true, required: false}
      - {label: "Type", name: "type", widget: "hidden", default: "quote"}
      - {label: "Title", name: "title", widget: "string", required: false}
      - {label: "Publish Date", name: "date", widget: "datetime"}
      - {label: "Body", name: "body", widget: "markdown"}  
      - {label: "Initials", name: "initials", widget: "string"}
  - name: "top-level-pages"
    label: "Top Level Pages" # Used in the UI
    folder: "source/top-level-pages" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "index" # Filename template, e.g., YYYY-MM-DD-title.md
    path: '{{title}}/{{slug}}'
    fields: # The fields for each document, usually in front matter
      - {label: "Draft", name: "draft", widget: "boolean", default: true, requried: false}
      - {label: "Type", name: "type", widget: "hidden", default: "top-level"}
      - {label: "Child Pages", name: "children", widget: "boolean", default: "false"}
      - {label: "Menu Label", name: "menulabel", widget: "string"}
      - {label: "Menu Order", name: "order", widget: "number"}
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Body", name: "body", widget: "markdown"}
  - name: "lower-level-pages" # Used in routes, e.g., /admin/collections/blog
    label: "Lower Level Pages" # Used in the UI
    folder: "source/lower-level-pages" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "index" # Filename template, e.g., YYYY-MM-DD-title.md
    path: '{{title}}/{{slug}}'
    fields: # The fields for each document, usually in front matter
      - {label: "Draft", name: "draft", widget: "boolean", default: true, required: false}
      - {label: "Type", name: "type", widget: "hidden", default: "lower-level"}
      - {label: "Child Pages", name: "children", widget: "hidden", default: "false"}
      - {label: "Parent Page Name", name: "parent", widget: "string"}
      - {label: "Menu Label", name: "menulabel", widget: "string"}
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Body", name: "body", widget: "markdown"}

Additional context Everything has been working as-is for weeks and is acting up seemingly out of nowhere.

BranonConor commented 4 years ago

Update, just sent myself a password-reset for that email I was trying to use, from the Identity section of that site in Netlify. I changed my password and got in. I'm not sure if the issue will persist though next time I log in, or what caused it in the first place.

erezrokah commented 4 years ago

Thanks for raising this @BranonConor, just to confirm, you got the error immediately after choosing the email? It didn't prompt for the password? Not sure how the identity password is relevant when clicking sign in with google. Were you eventually able to login using sign in with google or email and password (the one you changed).

erezrokah commented 4 years ago

Closing, please re-open if issue returns

lid commented 4 years ago

I saw this same issue (Git Gateway Error: [object Object] when trying to login to /admin) as well, but logging in with a GitHub identity. Like @BranonConor and folks in decaporg/decap-cms#3658, sending a password reset email from Netlify Identity and clicking the link seems to have resolved the issue. @erezrokah Clicking the password reset did not actually prompt for a new password.

sasilver75 commented 4 years ago

Having this problem with an 11ty site using Netlify CMS -- Password reset email from Netlify identity didn't resolve the issue from me image

erezrokah commented 4 years ago

Hi @sasilver75, can you try this https://github.com/netlify/netlify-cms/issues/1415#issuecomment-634864927 if relevant or re-generation the git-gateway token from Netlify site settings under identity? More resources: https://docs.netlify.com/visitor-access/git-gateway/ https://community.netlify.com/t/git-gateway-error/12220/15 Also, if any of the suggestions work can you comment on https://github.com/netlify/netlify-cms/issues/3827 with your issue and solution?

nikitattt commented 4 years ago

Hello. I also get this issue.

I'm using GitLab for git and Netlify Identity with Google OAuth. It has been running normally, but today I tried to log in to admin panel and got this error: image

Steps to reproduce:

  1. Open site
  2. Go to /admin -> netlify cms screen opes
  3. Click "Login with Netlify Identity" -> get error

I had the issue before(the same, it appeared with no reason), I have "solved" it by updating GitLab API access token few times and somehow error disappeared.

I have tried the same this time, but nothing seems to help. What I have tried:

  1. Updating GitLab API access token many times
  2. Updating GitLab API access token with running new deployment
  3. Tried setting different external authentication providers, even none
  4. Tried resetting password for the user

Well, while I was typing this...issue got resolved and I have been able to log in. Really strange issue. Maybe there are problems with GitLab?

AaratiAkkapeddi commented 2 years ago

I also am experiencing this issue.

im-coder-lg commented 2 years ago

Even me :(

cheapwebmonkey commented 2 years ago

I am also experiencing this issue

martinkean commented 2 years ago

Git Gateway Error: [object Object] Also experiencing this issue - and I am connecting using Github authentication. Was working fine yesterday, but today -bluh- Hopefully someone is keeping their eyes on this : )

smilenannan commented 2 years ago

Check the branch name. If you are using main branch, change branch name from master to main

backend:
    name: git-gateway
    branch: main
jordip commented 2 years ago

Check the branch name. If you are using main branch, change branch name from master to main

backend:
    name: git-gateway
    branch: main

This fixed the issue for me. Thank you!

paulcham commented 2 years ago

Clearing cookies fixed this for me.

ali4zimi commented 1 year ago

Check the branch name. If you are using main branch, change branch name from master to main

backend:
    name: git-gateway
    branch: main

This saved my day

andreisucman commented 12 months ago

I've tried clearing cookies, reissuing gateway tokens, deleting, and reenabling the identity. All the same.

decap-cms-app 3.0.7
bootstrap.js:59 decap-cms-core 3.2.4
index.js:27 decap-cms 3.0.7
api.github.com/repositories/683020530/branches/main:1     Failed to load resource: the server responded with a status of 401 ()
auth.js:96 API_ERROR: Git Gateway Error: Please ask your site administrator to reissue the Git Gateway token.
    at new t (https://unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:422:71984)
    at new i (https://unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:422:72291)
    at https://unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:14:13790
    at async https://unpkg.com/decap-cms@%5E3.0.0/dist/decap-cms.js:14:23049

Any suggestions?

im-coder-lg commented 12 months ago

Well, just a simple idea: using another token/resetting the Git token on Netlify could or might work. I don't know, but it might work, as the logs tell me that there is an issue with the token.