Where I can find CLOUDINARY_FOLDER environment variable for my project?

KibiDabi
KibiDabi Member Posts: 3
edited September 2023 in Developer APIs

I cloned one project from GitHub. In my .env.local file I have set the CLOUD_NAME, API_KEY and API_SECRET variables, and I also need to set the CLOUDINARY_FOLDER variable, but I don't know where I can find that.

I am getting this error:

Error: {"request_options":{"protocol":"https:","slashes":true,"auth":"my_api_key;:my_api_secret;","host":"api.cloudinary.com","port":null,"hostname":"api.cloudinary.com","hash":null,"search":null,"query":null,"pathname":"/v1_1/dqtzlwr74;/resources%2Fsearch","path":"/v1_1/dqtzlwr74;/resources%2Fsearch","href":"https://api.cloudinary.com/v1_1/dqtzlwr74;/resources%2Fsearch","method":"POST","headers":{"Content-Type":"application/json","User-Agent":"CloudinaryNodeJS/1.40.0 (Node 20.5.0)","Content-Length":80}},"query_params":"{\"sort_by\":[{\"public_id\":\"desc\"}],\"expression\":\"folder:'';/*\",\"max_results\":400}","error":{"message":"unknown api_key","http_code":401}}

Tagged:

Answers

  • Stephen
    Stephen Member, Cloudinary Staff Posts: 33
    edited September 2023

    Hi,

    "CLOUDINARY_FOLDER" isn't a standard part of the configuration for our SDK.

    If you're copying an example that has such a configuration variable defined, I recommend checking what the example does with the value and choosing the value yourself based on what the example is supposed to do.

    My guess is that it defines a specific folder of your Cloudinary account in which the code will upload files, and in that case, you can set it to whatever folder name you want the code to use.

    If that doesn't resolve it, i recommend contacting the author of the code and asking them how to configure it

    Regards,

    Stephen

  • KibiDabi
    KibiDabi Member Posts: 3

    Thank you very much, I set it to one of my folders. But I'm still getting this error about unknown api key. The strange thing is that, that I successfully deploy this app on Vercel with the same environment variables which I have defined locally in my vs code. And when I try to run this app, it constantly throwing me this error.

    Thank you for your time!

  • Wissam
    Wissam Member, Cloudinary Staff Posts: 103

    Hi there,

    The Unknown API key error indicates that you are not setting up your environment variable correctly or it is missing.

    Please see our guide on how to utilize the environment variables here: https://cloudinary.com/blog/build-performant-engaging-experiences-in-next-js-with-next-cloudinary#_strong_using_next_cloudinary_strong_

    You'll need to set the process.env variables to the appropriate values found in your Cloudinary account.

    Please let us know if you've already done this and are still receiving the error. If that is the case, please send over the console.log value of the process.env.CLOUDINARY_API_KEY and any other values you are receiving an error with.

    Regards,

    Wissam

  • KibiDabi
    KibiDabi Member Posts: 3

    The problem is solved. Thank you very much on your support!

    Regards,

    Samuel

  • Wissam
    Wissam Member, Cloudinary Staff Posts: 103

    Hi Samuel,

    Happy to see that the issue was resolved.

    Regards,

    Wissam