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

New behavior on latest versions: Unable to create new pages w/ git-gateway and gitlab #2383

Closed
unyo opened this issue Jun 15, 2019 · 12 comments · Fixed by #2390
Closed

New behavior on latest versions: Unable to create new pages w/ git-gateway and gitlab #2383

unyo opened this issue Jun 15, 2019 · 12 comments · Fixed by #2390

Comments

@unyo
Copy link

unyo commented Jun 15, 2019

Expected:
Able to create new pages via netlify-cms when using a gitlab repository and git-gateway as the backend

Actual:
Upon trying to create a new page, netlify-cms throws an error:

entries.js:592 TypeError: this.backend.unpublishedEntry is not a function
    at t.default.unpublishedEntry (implementation.js:502)
    at j.entryExist (backend.js:303)
    at j.generateUniqueSlug (backend.js:331)
    at j.persistEntry (backend.js:681)
    at entries.js:582
    at index.js:8
    at redux.js:462
    at Object.onPersist (Editor.js:102)
    at EditorInterface.js:147
    at Object.onSelection (Dropdown.js:85)

Applicable Versions:
"gatsby-plugin-netlify": "^2.0.17",
"gatsby-plugin-netlify-cms": "^4.0.2",
"netlify-cms": "^2.9.2",
"netlify-lambda": "^1.4.13",

CMS configuration

backend:
  name: git-gateway
  branch: master

Additional context

On this line:

https://github.com/netlify/netlify-cms/blame/0ce995d78c8123a32a3e9ef7117fd5386f3cd02d/packages/netlify-cms-core/src/backend.js#L266

this.interface.unpublishedEntries is always true since in git-gateway (below link) the function is always defined.

https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms-backend-git-gateway/src/implementation.js#L416

this.backend is either an instance of GitHubBackend or GitLabBackend, depending on whether it's gitlab or github.

https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms-backend-git-gateway/src/implementation.js#L416

Currently, only Github has a unpublishedEntries call:
https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms-backend-github/src/implementation.js#L246

Whereas unpublishedEntries it is missing from Gitlab:
https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms-backend-gitlab/src/implementation.js

And therefore when trying to create a new page, when trying to generateUniqueSlug, it'll fail with this.backend.unpublishedEntry is not a function since it doesn't exist in the instance of GitLabBackend.

@unyo unyo changed the title Unable to create new pages w/ git-gateway, gitlab, and latest netlify-cms+gatsby-plugin-netlify-cms Unable to create new pages w/ git-gateway and gitlab Jun 15, 2019
@unyo unyo changed the title Unable to create new pages w/ git-gateway and gitlab New behavior w/ latest versions: Unable to create new pages w/ git-gateway and gitlab Jun 15, 2019
@unyo unyo changed the title New behavior w/ latest versions: Unable to create new pages w/ git-gateway and gitlab New behavior on latest versions: Unable to create new pages w/ git-gateway and gitlab Jun 15, 2019
@erquhart
Copy link
Contributor

You're trying to use the editorial workflow with GitLab, which isn't supported yet. You can track the feature request here: #568

That said, this should be caught at load time and the CMS should provide an error message in the UI and block login, so that should be fixed.

Sent with GitHawk

@davidroberts63
Copy link

I'm seeing the exact same behavior. I had just created a new site and started noticing this. However I do not have the publish_mode set at all. Is there a default non-workflow value that people can use for that property? I'm also using gitlab.

@erquhart
Copy link
Contributor

@davidroberts63 did you use a starter or add the CMS to an existing site?

Sent with GitHawk

@unyo
Copy link
Author

unyo commented Jun 16, 2019

@erquhart I don't have publish_mode: editorial_workflow set in my config.yml set, and when I tried setting it to publish_mode: simple it didn't seem to change the behavior of throwing TypeError: this.backend.unpublishedEntry is not a function. When I try to set it to publish_mode: editorial_workflow I get redirected to an error on the login page Error: The GitLab backend does not support the Editorial Workflow.

@davidroberts63
Copy link

I've added it to an existing site. It's 11ty. I've done it with two other sites in the past.

The odd bit is that it can update an existing file just fine. Creating a new file is where the problem occurs.

I've double checked that I'm not using an older cashed version.

@unyo
Copy link
Author

unyo commented Jun 16, 2019

I'm trying to figure out which versions of netlify-cms + gatsby-plugin-netlify-cms work together properly.

gatsby-plugin-netlify-cms@latest is also throwing an error for me :( gatsbyjs/gatsby#14794

TypeError: Cannot read property "minimizer" of undefined

I'm on the last legs of creating my 5th site with gatsby + netlify cms, and I've hit a stumbling block.

Edit: I was able to bring back the CMS functionality by falling back to netlify-cms@2.9.1 and gatsby-plugin-netlify-cms@4.0.1 👍

@idiazroncero
Copy link

I'm having the same exact problem:

Netlify: 2.9.2
Git repo: Gitlab

Not using Gatsby nor netlify-lambda, using 11ty as the static site builder.

My 11ty site was built with Eleventy CMS from the begining, and it always worked until this release.

Config.yml doesn't set a editorial_workflow and is as follows:

backend:
  name: git-gateway
  branch: master 

Can't publish new content, the entries.js:592 TypeError: this.backend.unpublishedEntry appear

@idiazroncero
Copy link

Tried resetting Gitlab token, to no avail.
Only downgrading to 2.9.1 works.

@talves
Copy link
Collaborator

talves commented Jun 18, 2019

@unyo just a note, you should not be using netlify-cms with ^4.0 of gatsby-plugin-netlify-cms, you should use netlify-cms-app. and it looks like the minimizer issue has been resolved.

@talves
Copy link
Collaborator

talves commented Jun 18, 2019

@barthc can you see if this issue was introduced in #2139

@jspizziri
Copy link

Our project is in Hugo and is hosted on GitLab

Backend Config:

backend:
  name: git-gateway
  branch: master # Branch to update (optional; defaults to master)

Stack Trace:

entries.js:592 TypeError: this.backend.unpublishedEntry is not a function
    at t.default.unpublishedEntry (implementation.js:502)
    at j.entryExist (backend.js:303)
    at j.generateUniqueSlug (backend.js:331)
    at j.persistEntry (backend.js:681)
    at entries.js:582
    at index.js:8
    at redux.js:462
    at Object.onPersist (Editor.js:102)
    at EditorInterface.js:147
    at Object.onSelection (Dropdown.js:85)

@barthc
Copy link
Contributor

barthc commented Jun 18, 2019

@talves Yes #2139 introduced this issue, I will send in a PR to address the issue.

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

Successfully merging a pull request may close this issue.

7 participants