Must supply api_key Error

Options
Bilal
Bilal Member Posts: 1
edited May 20 in Developer APIs


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;


Tagged:

Answers

  • Tamara
    Tamara Member, Cloudinary Staff Posts: 106
    Options

    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 that cloudinary.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