Must supply api_key Error
import { v2 as cloudinary } from "cloudinary";
cloudinary.config({ cloud_name: process.env.CLOUDINARY_CLOUD_NAME, api_key: process.env.CLOUDINARY_API_KEY, api_secret: process.env.CLOUDINARY_API_SECRET });
const uploadOnCloudinary = async (localFilePath) => { try { // Upload the image const result = await cloudinary.uploader.upload(localFilePath); console.log(result); return result; } catch (error) { console.error(error); }};
export default uploadOnCloudinary;
Answers
-
Hi @Bilal,
The 'must supply api_key' error implies that we're not receiving the correct cloud name and API key in the API call made by your app.
Are you sure thatcloudinary.config
is set correctly and that the correct values are being used by the SDK? Does it work if you configure the SDK with the environment variable instead of the exact values?
Kind regards,Tamara
0