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

Cannot read properties of undefined when loading decap-cms-backend-gitlab #7320

Open
simevo opened this issue Nov 1, 2024 · 0 comments
Open
Labels
type: bug code to address defects in shipped code

Comments

@simevo
Copy link

simevo commented Nov 1, 2024

Describe the bug

When I serve index.html and config.yml listed below with a test webserver (for example python3 -m http.server then open http://localhost:8000) I get:

Uncaught TypeError: Cannot read properties of undefined (reading 'EmotionCore')
    at universalModuleDefinition:9:127
    at universalModuleDefinition:1:1

Additionally if I add:

<script>
  CMS.registerBackend('gitlab-test', DecapCmsBackendGitlab.GitLabBackend);
</script>

it fails with:

(index):30 Uncaught ReferenceError: DecapCmsBackendGitlab is not defined
    at (index):30:37

To Reproduce

index.html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="robots" content="noindex" />
    <title>Content Manager</title>
  </head>
  <body>
    <script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
    <script src="https://unpkg.com/decap-cms-backend-gitlab@^3.0.0/dist/decap-cms-backend-gitlab.js"></script>
  </body>
</html>

Expected behavior

I expected the module to load and add DecapCmsBackendGitlab to the global scope the way netlify-cms-backend-gitlab.js would do for NetlifyCmsBackendGitlab, but it doesn't.

Screenshots

The UI seems to load fine though:

image

Applicable Versions:

  • Decap CMS version: 3.1.3
  • Git provider: -
  • OS: Debian 12 (stable)
  • Browser version: Chromium 130.0.6723.58

CMS configuration

backend:
  name: gitlab
  branch: main # Branch to update (optional; defaults to master)
  repo: tinia-euregio/tinia-website
media_folder: "images/uploads" # Media files will be stored in the repo under images/uploads
collections:
  - name: "blog" # Used in routes, e.g., /admin/collections/blog
    label: "Blog" # Used in the UI
    folder: "_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: "Title", name: "title", widget: "string" }

Additional context

We have forked decap-cms-backend-gitlab as let's say decap-cms-backend-gitlab-forked and we were trying to load it as in:

<script src="dist/decap-cms-backend-gitlab-forked.js"></script>
<script>
  CMS.registerBackend('gitlab-forked, DecapCmsBackendGitlabForked.GitLabBackend);
</script>

and started getting similar errors.

So I wondered "is it our fork or upstream?" and tried loading your version (I know it's not strictly required, as the gitlab backend is built-in).

@simevo simevo added the type: bug code to address defects in shipped code label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant