Describe the bug
When I add
media_library:
name: uploadcare
config:
publicKey: my_real_public_key
to my config.yaml and then open /admin page, Uploadcare widget doesn't show up and I see
netlify-cms-app.js:255 Uncaught (in promise) TypeError: Cannot read property 'init' of undefined
at netlify-cms-app.js:255
in devtools console. If I remove media_library option, error goes away.
Expected behavior
There shouldn't be an error in console and widget should show up
Applicable Versions:
CMS configuration
````
backend:
name: git-gateway
accept_roles:
- admin
branch: master
repo: name/my_real_repo
public_folder: /img
media_folder: static/img
media_library:
name: uploadcare
config:
publicKey: my_real_public_key
collections:
Additional context
I'm using netlify-cms with Gatsby
@smashercosmo Are you using the new 4.0.0 plugin with netlify-cms-app?
If so, you will need to add the Uploadcare widget to the project and then register it. They were left out to make the app library to not carry the large media libraries unless needed.
We should document this in the case someone does not know how to add this to their project.
Alright) Thx for the explanation
@talves Sorry for bothering you again, but could you please describe how am I supposed to do that)
I assume I need to
npm i netlify-cms-app netlify-cms-media-library-uploadcare{
resolve: 'gatsby-plugin-netlify-cms',
options: {
modulePath: `${__dirname}/src/cms/cms.js`,
}
}
src/cms/cms.js
import CMS from 'netlify-cms-app'
import uploadcare from 'netlify-cms-media-library-uploadcare';
CMS.registerMediaLibrary(uploadcare);
_Note:_ make sure to remove netlify-cms from the project. Update gatsby-plugin-netlify-cms to v4.x
@talves Alright, it works, thank you
Hey guys @talves @smashercosmo @barthc
This thread helped me to add uploadcare widget correctly, I am able to use it when creating new post in netlify/admin. I can add pictures, config is working correctly since I passed it multiple: true.
But when I try to publish new product in my collection I get an error:
GET http://localhost:8000/api/file/src/pages/products/2019-06-21-zoran-manijak.md?ts=1561118671837 500 (Internal Server Error)
TypeError: Cannot read property 'includes' of undefined
at netlify-cms-app.js:16
at async j.entryExist (netlify-cms-app.js:16)
at async j.generateUniqueSlug (netlify-cms-app.js:16)
at async j.persistEntry (netlify-cms-app.js:16)
at async Object.onPersist (netlify-cms-app.js:227)
Uncaught (in promise)
{type: "ENTRY_PERSIST_FAILURE", error: "Failed to persist entry", payload: {鈥}
error: "Failed to persist entry"
payload: {collectionName: "products", entrySlug: "", error: "TypeError: Cannot read property 'includes' of undefined"}
type: "ENTRY_PERSIST_FAILURE"
Thanks
I hope @talves's reply gets added to the docs at some point!
Opened this issue: https://github.com/netlify/netlify-cms/issues/2855
Most helpful comment
src/cms/cms.js_Note:_ make sure to remove
netlify-cmsfrom the project. Updategatsby-plugin-netlify-cmsto v4.x