Closed peterstory closed 4 months ago
+1, seeing exactly the same behavior.
The request to GitLab 404s. When I make the same exact request (using cURL) and change the Authorization header by replacing "token" with "Bearer," the request succeeds.
+2 can confirm - same issue with a self-hosted gitlab instance.
Does login work on your setups with any of the previous versions of Decap?
@martinjagodic I hardcoded the version to 3.1.2, and I logged in without issue. So it seems there was a regression.
@peterstory 3.1.2 is the version you mentioned in the original comment as the one with the problem. The latest is 3.1.10. If you have some time, could you check which versions have the problem and which don't? So we can identify the culprit more easily.
To clarify, when I opened the issue my admin page used this URL:
https://cdn.jsdelivr.net/npm/decap-cms@^3.1.2/dist/decap-cms.js
Following the URL and searching the source code shows that: version:"decap-cms@3.1.10"
Then, I edited the URL to be:
https://cdn.jsdelivr.net/npm/decap-cms@3.1.2/dist/decap-cms.js
Which of course has: version:"decap-cms@3.1.2"
So I have the error with 3.1.10, and I don't have the error with 3.1.2.
I'm having the same problem using "the latest version", when reverting to specific 3.1.2 the problem no longer exists. Using gitlab.com
Was being driven mad by this issue today.
I found the exact piece of code that is causing the issue....
At the following link you can see a piece of code was introduced that calls getDefaultBranchName()
getDefaultBranchName() calls apiRequest()
https://github.com/decaporg/decap-cms/blob/main/packages/decap-cms-lib-util/src/API.ts#L239
apiRequest() calls constructRequestHeaders()
constructRequestHeaders() then explicitly uses "token" instead of "Bearer" (which is what gitlab requires) causing the error to be thrown
https://github.com/decaporg/decap-cms/blob/main/packages/decap-cms-lib-util/src/API.ts#L185
Describe the bug After logging into Decap, I get a "404 Project Not Found" error.
To Reproduce
Expected behavior The Decap CMS GUI should load.
Screenshots I'm stuck at "Logging in..."
Applicable Versions:
CMS configuration https://trinityworc.gitlab.io/admin/config.yml
Additional context Console errors:
This request was successful:
This request gave a 404: