-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
area: extensions/backends/gitlabtype: bugcode to address defects in shipped codecode to address defects in shipped code
Description
Describe the bug
I tried to use DecapCMS with gitlab backend and use_graphql: true
option.
I tried with two different self-hosted gitlab without API quotas.
The Gitlab API answers :
- the correct answer if I execute direct requests (using Postman or gitlab integrated graphicl) ;
- the correct answer If I execute query on Google Chrome without CORS security ;
{"data":{"project":null}}
if queries are executed in "standard mode" (localhost, production, on Firefox, Chrome, etc.)
To Reproduce
Steps to reproduce the behavior. For example:
- Create a DecapCMS with Gitlab self-hosted backend ;
- Configure the
use_graphiql: true
option - See that data are loaded using REST API and that dropdown populate is broken
- Check that Graphql answers are
{"data":{"project":null}}
Expected behavior
Everything works.
Applicable Versions:
Latest.
CMS configuration
I dont't have one with public Gitlab project.
Fix
I have found that Gitlab authentication header should be
Authorization: Bearer <token>
Source : https://docs.gitlab.com/api/graphql/
But in DecapCMS we use :
authorization: this.token ? `token ${this.token}` : '',
Source : https://github.com/decaporg/decap-cms/blob/main/packages/decap-cms-backend-gitlab/src/API.ts#L246
I changed that line and rebuilt it and it works perfectly fine for me.
(and btw, it’s awesome how it's easy to dev and build DecapCMS locally 👏 👏 )
Metadata
Metadata
Assignees
Labels
area: extensions/backends/gitlabtype: bugcode to address defects in shipped codecode to address defects in shipped code