finkinfridom / payload-cloudinary-plugin Goto Github PK
View Code? Open in Web Editor NEWUpload media to Cloudinary service
License: MIT License
Upload media to Cloudinary service
License: MIT License
I have done the configuration part as mentioned in the plugin readme, but still unable to successfully fulfil the request, when trying to upload getting error : ERROR (payload): APIError: Cloudinary: {}
my Server.ts
file
app.use(mediaManagement(cloudinaryConfig))
My cloudinaryConfig
Object
const cloudinaryConfig = cloudinary.config({ cloud_name: process.env.CLOUDINARY_CLOUD_NAME, api_key: process.env.CLOUDINARY_API_KEY, api_secret: process.env.CLOUDINARY_API_SECRET, });
My payload.config.ts
file
plugins: [cloudinaryPlugin()],
Hey,
Thanks for writing this plugin ❤️.
When I try to use it in my typescript payload app, i get the error Cannot find module 'payload-cloudinary-plugin' or its corresponding type declarations.
when I try to import it.
If i import it via import { mediaManagement } from "payload-cloudinary-plugin/src/index";
, then I get an error when i try to run the app ==> SyntaxError: Cannot use import statement outside a module
Am I doing something wrong here?
Hey @finkinfridom ,
Thanks again.
The issue is that images are being uploaded but no other file is accepted.
Even if I add the allowed formats in an array like so allowed_formats: ["png", "jpg", "jpeg", "pdf", "csv", "xlsx"]
I still get the error : APIError: Cloudinary: {"message":"Invalid image file","name":"Error","http_code":400}
Hi guys,
I am trying out this cloudinary plugin but, I am having trouble getting it to work.
I am receiving the following error:
at D:\projects\personal-website\node_modules\payload-cloudinary-plugin\dist\plugins\cloudinaryPlugin.js:127:23
at step (D:\projects\personal-website\node_modules\payload-cloudinary-plugin\dist\plugins\cloudinaryPlugin.js:44:23)
at Object.throw (D:\projects\personal-website\node_modules\payload-cloudinary-plugin\dist\plugins\cloudinaryPlugin.js:25:53)
at rejected (D:\projects\personal-website\node_modules\payload-cloudinary-plugin\dist\plugins\cloudinaryPlugin.js:17:65)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
I think it's trying to upload the file I am adding to payload before it's every hitting the media directory which is causing it to throw a file not existing error.
My config is set up as directed to the readme.md and my credentials work:
server.ts
const server = express();
const cloudinaryConfig = cloudinary.config({
cloud_name: '********',
api_key: '********'',
api_secret: '********'',
});
server.use(mediaManagement(cloudinaryConfig));
payload.config.ts
.
.
.
plugins: [
formBuilder({
redirectRelationships: [
'pages',
],
}),
cloudinaryPlugin(),
],
});
thanks for looking into this issue!
Hey @finkinfridom , me again lol
When I delete images from the admin ui, they get deleted in cloudinary but other file types are not.
e.g: I upload a csv/pdf/exe file - I see them in cloudinary even after they are deleted from the database.
I think it has to do with how the public ID's are stored for other files vs images. The public ID's for files other than images have the extension on them. So a csv file's public ID would look like this [FOLDER_NAME]/jhgcv23lkjhbvkk.csv
while the image would be named - [FOLDER_NAME]/kjhv23glhkjlkblkjhb
Add support
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
).github/workflows/codeql.yml
actions/checkout v4
github/codeql-action v2
github/codeql-action v2
github/codeql-action v2
.github/workflows/linter.yml
actions/checkout v4
github/super-linter v5
.github/workflows/publish.yml
actions/checkout v4
actions/setup-node v4
.github/workflows/test.yml
actions/checkout v4
actions/setup-node v4
package.json
cloudinary ^1.32.0
dotenv ^16.0.0
payload ^1.2.1
@types/jest 29.5.6
@typescript-eslint/eslint-plugin ^5.43.0
@typescript-eslint/parser ^5.43.0
eslint ^8.27.0
jest 29.7.0
serve ^14.0.1
ts-jest 29.1.1
ts-node 10.9.1
typescript 5.2.2
node >=8.3.0
My image collection have set disableLocalStorage
to true, so images are not being stored locally but payload will still create an empty directory with the name of the collection at root, is it possible to disable this behavior too?
Hi, I was using the plugin but couldn't find any place to provide the secret key and API key and so on
@finkinfridom
I am on the newest version of Payload 2.0.14. I installed the payload-cloudinary-plugin. Works perfectly in development, zero complaints. Then I tried to commit the changes but it then fails in the build step.
In the payload.config.ts file, if I remove the cloudinaryPlugin() part, the build works. So I am pretty sure that this is the part causing the trouble.
plugins: [cloudinaryPlugin(), payloadCloud()],
I attached the stack-trace but I am not sure how helpful it is and it might be a bit difficult to read. Any idea what might be the issue here ? I am not quite sure whether this is a plugin issue or whether it is an issue with payload.
Nov 1 03:53:06 PM #13 81.28 src/payload.config.ts(115,13): error TS2322: Type 'import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/config/types").Plugin' is not assignable to type 'import("/home/node/app/node_modules/payload/dist/config/types").Plugin'.
Nov 1 03:53:06 PM #13 81.28 Types of parameters 'config' and 'config' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type 'import("/home/node/app/node_modules/payload/dist/config/types").Config' is not assignable to type 'import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/config/types").Config'.
Nov 1 03:53:06 PM #13 81.28 The types of 'admin.bundler.build' are incompatible between these types.
Nov 1 03:53:06 PM #13 81.28 Type '(payloadConfig: import("/home/node/app/node_modules/payload/dist/config/types").SanitizedConfig) => Promise<void>' is not assignable to type '(payloadConfig: import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/config/types").SanitizedConfig) => Promise<void>'.
Nov 1 03:53:06 PM #13 81.28 Types of parameters 'payloadConfig' and 'payloadConfig' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type 'import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/config/types").SanitizedConfig' is not assignable to type 'import("/home/node/app/node_modules/payload/dist/config/types").SanitizedConfig'.
Nov 1 03:53:06 PM #13 81.28 Type 'SanitizedConfig' is not assignable to type 'Omit<{ admin: { autoLogin: false | { email: string; password: string; prefillOnly: boolean; }; avatar: "default" | "gravatar" | ComponentType<any>; buildPath: string; bundler: { ...; }; ... 11 more ...; webpack: (config: Configuration) => Configuration; }; ... 28 more ...; upload: any; }, "collections" | ... 2 more ...'.
Nov 1 03:53:06 PM #13 81.28 The types of 'admin.bundler.build' are incompatible between these types.
Nov 1 03:53:06 PM #13 81.28 Type '(payloadConfig: import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/config/types").SanitizedConfig) => Promise<void>' is not assignable to type '(payloadConfig: import("/home/node/app/node_modules/payload/dist/config/types").SanitizedConfig) => Promise<void>'.
Nov 1 03:53:06 PM #13 81.28 Types of parameters 'payloadConfig' and 'payloadConfig' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type 'import("/home/node/app/node_modules/payload/dist/config/types").SanitizedConfig' is not assignable to type 'import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/config/types").SanitizedConfig'.
Nov 1 03:53:06 PM #13 81.28 Type 'SanitizedConfig' is not assignable to type 'Omit<{ admin: { autoLogin: false | { email: string; password: string; prefillOnly: boolean; }; avatar: "default" | "gravatar" | ComponentType<any>; buildPath: string; bundler: { ...; }; ... 11 more ...; webpack: (config: Configuration) => Configuration; }; ... 28 more ...; upload: any; }, "collections" | ... 2 more ...'.
Nov 1 03:53:06 PM #13 81.28 Types of property 'db' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type '(args: { payload: import("/home/node/app/node_modules/payload/dist/payload").Payload; }) => import("/home/node/app/node_modules/payload/dist/database/types").BaseDatabaseAdapter' is not assignable to type '(args: { payload: import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/payload").Payload; }) => import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/database/types").BaseDatabaseAdapter'.
Nov 1 03:53:06 PM #13 81.28 Types of parameters 'args' and 'args' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type '{ payload: import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/payload").Payload; }' is not assignable to type '{ payload: import("/home/node/app/node_modules/payload/dist/payload").Payload; }'.
Nov 1 03:53:06 PM #13 81.28 The types of 'payload.collections' are incompatible between these types.
Nov 1 03:53:06 PM #13 81.28 Type '{ [slug: string]: import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/collections/config/types").Collection; [slug: number]: import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/collections/config/types").Collection; [slug: symbol]: import("/home...' is not assignable to type '{ [slug: string]: import("/home/node/app/node_modules/payload/dist/collections/config/types").Collection; [slug: number]: import("/home/node/app/node_modules/payload/dist/collections/config/types").Collection; [slug: symbol]: import("/home/node/app/node_modules/payload/dist/collections/config/types").Collection; }'.
Nov 1 03:53:06 PM #13 81.28 'string' index signatures are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type 'import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/collections/config/types").Collection' is not assignable to type 'import("/home/node/app/node_modules/payload/dist/collections/config/types").Collection'.
Nov 1 03:53:06 PM #13 81.28 The types of 'config.auth.forgotPassword.generateEmailHTML' are incompatible between these types.
Nov 1 03:53:06 PM #13 81.28 Type 'GenerateForgotPasswordEmailHTML' is not assignable to type 'GenerateForgotPasswordEmailHTML'. Two different types with this name exist, but they are unrelated.
Nov 1 03:53:06 PM #13 81.28 Types of parameters 'args' and 'args' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type '{ req?: import("/home/node/app/node_modules/payload/dist/express/types").PayloadRequest<any>; token?: string; user?: unknown; }' is not assignable to type '{ req?: import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/express/types").PayloadRequest<any>; token?: string; user?: unknown; }'.
Nov 1 03:53:06 PM #13 81.28 Types of property 'req' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type 'import("/home/node/app/node_modules/payload/dist/express/types").PayloadRequest<any>' is not assignable to type 'import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/express/types").PayloadRequest<any>'.
Nov 1 03:53:06 PM #13 81.28 Type 'PayloadRequest<any>' is not assignable to type '{ collection?: Collection; context: RequestContext; fallbackLocale?: string; files?: { file: UploadedFile; }; findByID?: { [transactionID: string]: { [slug: string]: (q: FindOneArgs) => Promise<TypeWithID>; }; }; ... 8 more ...; user: any; }'.
Nov 1 03:53:06 PM #13 81.28 The types of 'collection.config.auth.forgotPassword.generateEmailHTML' are incompatible between these types.
Nov 1 03:53:06 PM #13 81.28 Type 'GenerateForgotPasswordEmailHTML' is not assignable to type 'GenerateForgotPasswordEmailHTML'. Two different types with this name exist, but they are unrelated.
Nov 1 03:53:06 PM #13 81.28 Types of parameters 'args' and 'args' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type '{ req?: import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/express/types").PayloadRequest<any>; token?: string; user?: unknown; }' is not assignable to type '{ req?: import("/home/node/app/node_modules/payload/dist/express/types").PayloadRequest<any>; token?: string; user?: unknown; }'.
Nov 1 03:53:06 PM #13 81.28 Types of property 'req' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type 'import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/express/types").PayloadRequest<any>' is not assignable to type 'import("/home/node/app/node_modules/payload/dist/express/types").PayloadRequest<any>'.
Nov 1 03:53:06 PM #13 81.28 Type 'PayloadRequest<any>' is not assignable to type '{ collection?: Collection; context: RequestContext; fallbackLocale?: string; files?: { file: UploadedFile; }; findByID?: { [transactionID: string]: { [slug: string]: (q: FindOneArgs) => Promise<TypeWithID>; }; }; ... 8 more ...; user: any; }'.
Nov 1 03:53:06 PM #13 81.28 The types of 'collection.config.auth.verify' are incompatible between these types.
Nov 1 03:53:06 PM #13 81.28 Type 'boolean | import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/auth/types").VerifyConfig' is not assignable to type 'boolean | import("/home/node/app/node_modules/payload/dist/auth/types").VerifyConfig'.
Nov 1 03:53:06 PM #13 81.28 Type 'VerifyConfig' is not assignable to type 'boolean | VerifyConfig'.
Nov 1 03:53:06 PM #13 81.37 error Command failed with exit code 2.
Nov 1 03:53:06 PM #13 81.37 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Nov 1 03:53:06 PM #13 81.41 error Command failed with exit code 2.
Nov 1 03:53:06 PM #13 81.41 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Nov 1 03:53:06 PM #13 ERROR: process "/bin/sh -c yarn build" did not complete successfully: exit code: 2
Nov 1 03:53:06 PM ------
Nov 1 03:53:06 PM > [builder 5/5] RUN yarn build:
Nov 1 03:53:06 PM #13 81.28 Types of property 'req' are incompatible.
Nov 1 03:53:06 PM #13 81.28 Type 'import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/express/types").PayloadRequest<any>' is not assignable to type 'import("/home/node/app/node_modules/payload/dist/express/types").PayloadRequest<any>'.
Nov 1 03:53:06 PM #13 81.28 Type 'PayloadRequest<any>' is not assignable to type '{ collection?: Collection; context: RequestContext; fallbackLocale?: string; files?: { file: UploadedFile; }; findByID?: { [transactionID: string]: { [slug: string]: (q: FindOneArgs) => Promise<TypeWithID>; }; }; ... 8 more ...; user: any; }'.
Nov 1 03:53:06 PM #13 81.28 The types of 'collection.config.auth.verify' are incompatible between these types.
Nov 1 03:53:06 PM #13 81.28 Type 'boolean | import("/home/node/app/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/auth/types").VerifyConfig' is not assignable to type 'boolean | import("/home/node/app/node_modules/payload/dist/auth/types").VerifyConfig'.
Nov 1 03:53:06 PM #13 81.28
This plugin currently doesn't work with Payload 2.0. Are there plans to make it work with the new version?
Type 'import("c:/WebDevelopment/MyProjects/Projects/portfolio/portfolio_backend/node_modules/payload-cloudinary-plugin/node_modules/payload/dist/config/types").Plugin' is not assignable to type 'import("c:/WebDevelopment/MyProjects/Projects/portfolio/portfolio_backend/node_modules/payload/dist/config/types").Plugin'.
Types of parameters 'config' and 'config' are incompatible.
Got this warning after installing the package, its working in development but failing in production environemnt, how can i resolve this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.