decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.94k stars 3.04k forks source link

Uploading images with GitLab as backend is broken #1565

Closed Kavakuo closed 6 years ago

Kavakuo commented 6 years ago

- Do you want to request a feature or report a bug? Bug, see below for the bugfix. Pull request is coming.

- What is the current behavior? Uploading images with GitLab as backend is broken.

- If the current behavior is a bug, please provide the steps to reproduce. Use GitLab as backend and try to upload a new image.

- What is the expected behavior? The image is uploaded and commited by the cms.

- Bugfix Use the result function instead of get in the uploadAndCommit function (see here). I will create a pull request to fix this issue.

- Please link or paste your config.yml below if applicable.

backend:
  name: gitlab
  branch: master # Branch to update (optional; defaults to master)
  repo: [repository]
  auth_type: implicit # Required for implicit grant
  app_id: [applicationId] # Application ID from your GitLab settings
  api_root: https://gitlab.lan/api/v4
  base_url: https://gitlab.lan
  auth_endpoint: oauth/authorize
tech4him1 commented 6 years ago

Thanks for working on a PR, let us know if you need any help!

estherholleman commented 6 years ago

This is still not working for me. It builds fine, but when I try to change or upload an image I still get 'no assets found' even with a fresh install of the official Gatsby starter with GitLab and after updating gatsby-plugin-netlify-cms to version ^1.0.12, gatsby-plugin-netlify to ^1.0.21, and netlify-cms to "^1.9.3 . Is there perhaps anything else I should be updating or something I'm forgetting?

tech4him1 commented 6 years ago

@estherholleman This fix was released in CMS version 2.0.7, please upgrade and try again.

piedoom commented 6 years ago

I am still getting the error on 2.0.8, I will update soon with more details

estherholleman commented 6 years ago

When I update to 2.07 or 2.08 I get the error: error There was an error compiling the html.js component for the development server. Error: Module not found: Error: Cannot resolve module 'netlify-cms/dist/cms.css' ,node_modules/netlify-cms/dist/cms.css doesn't exist (directory default file). I have no idea how to get that css file in there, I did install netlify-cms and there is a netlify-cms folder in my node-modules folder.

Building process on Netlify results in: error Generating JavaScript bundles failed Error: ./~/gatsby-plugin-netlify-cms/cms.js Module not found: Error: Cannot resolve module 'netlify-cms/dist/cms.css' in / opt/build/repo/node_modules/gatsby-plugin-netlify-cms

Next I tried a fresh install of the gatsby netlify cms tutorial https://www.gatsbyjs.org/docs/netlify-cms/ , same error when running gatsby develop as soon as I add netlify cms (version 2.0.8) to the gatsby hello world starter (following the exact instructions there).

estherholleman commented 6 years ago

So in my case this was a problem with the gatsby-plugin-netlify-cms not working with any netlify cms version above 2 on gatsby v1, (https://github.com/gatsbyjs/gatsby/issues/6802). I've created a test site in gatsby v2 with netlify cms v2.0.8 and image uploading works there.

tech4him1 commented 6 years ago

@estherholleman Great, glad you got it working.

@piedoom If you don't mind, can you open a new issue instead of commenting here?

piedoom commented 6 years ago

Sure, I will do that in a moment!

tech4him1 commented 6 years ago

@piedoom Still an issue?

DavidRayner commented 6 years ago

I still have this issue with my site which was based off the hugo starter I will try to reproduce with the hugo starter upgraded to v2.x

image

DavidRayner commented 6 years ago

I believe this issue still exists on netlify-cms 2.0.9

I made a Netlify site using GitHub and https://github.com/DavidRayner/one-click-hugo-cms. I was able to upload media without any problem.

I made another Netlify site using GitLab and https://gitlab.com/davidrayner/one-click-hugo-cms (an import of the working GH repo) - and I was not able to upload media.

tech4him1 commented 6 years ago

@DavidRayner I can reproduce, looking into it. For some reason, Redux is getting a MEDIA_LOAD_FAILURE. This line is then undefined:

https://github.com/netlify/netlify-cms/blob/f801b192211b1e1953ced969a3093eab9e04e14d/packages/netlify-cms-core/src/actions/mediaLibrary.js#L84

piedoom commented 6 years ago

Thanks for posting more info @DavidRayner - sorry I haven't been at the computer much lately so I was unable to respond with further stuff. This is the exact behavior i am experiencing as well.

tech4him1 commented 6 years ago

@piedoom @DavidRayner Great, at least we have a repro case. I've opened a new issue to track this problem, let's move discussion there: https://github.com/netlify/netlify-cms/issues/1608.