Unknown API Key *************
I have a program (node.js) that uploads pdf's to Cloudinary. When I run it on my program (localhost) it works just fine. When I run it on hosted Vercel with the same environmental variables it times out and gives me this:
Unknown API key "12345678910"
The API key is correct, it's the same one I use when running it on my local machine. It's the API key for Cloudinary. Thoughts?
Why does it work on my machine and not when hosted on Vercel?
-
Hi Christo,
The error indicates that the API key supplied in your request is "12345678910" which seems to be not the correct API key for your account.
You could check your environment to make sure that you are passing the correct API key.
Please let me know how it goes.
Thanks,
Francis0 -
Hi,
I have considered that. However it works when I do it on local host, that would seem to indicate that the API key is correct, yes? Additionally I copy and past the key to the environmental variable on the hosting platforms, so it should be the same key. When the error comes up, the key it says is unknown is the same key on my cloudinary dashboard. I have console logged the key it uses and it's the same key.
I get the same issue on Vercel and Render when I host this project.
So the question remains, why does it work on local host but not when hosted online?
Thanks,
Christo
0 -
Hi Christo.
I've not personally used Vercel or Render, however I have used other hosting providers and they don't typically allow for an environment variable to be declared in the terminal directly and then used. Instead, it's best practice to set up environment variables/secrets in the UI and call them with your code accordingly:
- https://vercel.com/docs/concepts/projects/environment-variables
- https://render.com/docs/configure-environment-variables#configuring-secrets-and-other-environment-information-on-render
Ultimately though, I think this is a question best suited for Vercel or Render's support teams, as they'd have a better idea of what is going on behind the scenes and why your environment variable might not be persisting. Could you please try getting in touch with them?
If there's any information we can provide to help them to debug, please let us know and we'll do our best to assist.
Many thanks,
-Danny0 -
Danny,
Thanks for reaching out with a possible solution. As for declaring the environmental variables, my apologies for being unclear. I do not declare them in the terminal, I declare them in the Vercel's & Render's environmental variable settings before the project is built by them. The console log was me checking to make sure the variable was correct (and wasn't undefined or something), and it was indeed the correct Key.
The most confusing part to me is that when the error message prints out "Unknown API Key: 12345678910" the unknown key is the same as my Cloudinary API Key of: 12345678910.
Cheers,
Christo
0
Post is closed for comments.
Comments
4 comments