decaporg / decaporg/decap-cms

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

Open
#7,320 1 comment 1 reaction 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**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:

```html

CMS.registerBackend('gitlab-test', DecapCmsBackendGitlab.GitLabBackend);

```

it fails with:

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

**To Reproduce**

`index.html`:

```html





Content Manager




```

**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](https://github.com/user-attachments/assets/7442de37-939d-42b8-a2dd-5fb20703b6f5)

**Applicable Versions:**

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

**CMS configuration**

```yaml
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:

```html

CMS.registerBackend('gitlab-forked, DecapCmsBackendGitlabForked.GitLabBackend);

```

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).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.