Unable to upload images in deployed Strapi App - help figure out why

Hello, I successfully deployed a Strapi app to Render and seems to be working well. However, while testing the deployed app via Stapi, I notice that I am unable to upload images.

In the log I can see a message: error: Must supply api_key, But I entered all the required info needed for Cloudinary to work. Can you help debug it?

Log

Sep 14 01:40:58 PM  (node:70) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 13)
Sep 14 01:40:58 PM  (Use `node --trace-warnings ...` to show where the warning was created)
Sep 14 01:40:58 PM  (node:70) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 15)
Sep 14 01:40:58 PM  [2022-09-14 17:40:58.550] error: Must supply api_key
Sep 14 01:41:01 PM  [2022-09-14 17:41:01.629] http: GET /_health (0 ms) 204
Sep 14 01:41:06 PM  [2022-09-14 17:41:06.627] http: GET /_health (0 ms) 204
Sep 14 01:41:11 PM  [2022-09-14 17:41:11.627] http: GET /_health (0 ms) 204
Sep 14 01:41:16 PM  [2022-09-14 17:41:16.628] http: GET /_health (0 ms) 204

Related image

Thanks

Hi Chris,

Thanks for reaching out.

Sounds like you’re on the right lines, probably best to double-check any environment variables you’ve set and that they are named correctly, and that the value is also valid. Along with checking the code that references the values is correct/no typos.

Hope that helps

Alan

Hello Alan,
Thank you so much for your timely response. I sincerely appreciate your prompt reply. I double-checked the environment variable names and values, and they seemed to be entered correctly (please refer to the attached image). Although I noticed that render prefixed all the cloudinary keys with process.env - Perhaps this might be the cause of the issue, would you agree, should I just rename them as “CLOUDINARY_NAME” instead rather than “process.env.CLOUDINARY_NAME” ?

Ah, yes. process.env is how Node reads an environment variable. In the Render Dashboard, you’d just use the var name:

  • CLOUDINARY_KEY
  • CLOUDINARY_NAME
  • CLOUDINARY_SECRET

Which would then be accessed in Node as:

  • process.env.CLOUDINARY_KEY
  • process.env.CLOUDINARY_NAME
  • process.env.CLOUDINARY_SECRET

Alan

Hello Alan,
Thanks again for your response. That solves the issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.