Fetch requests to third party api
I'm new to workers. I have a very simple script that reaches out to the API for ipqualityscore.com. They API is authenticated with an API key in the url. This works as expected with the wrangler dev server, but in production I get an error back from the API that the API key is invalid. I have quadruple checked this, and if I log the url that fetch is reaching out to and just paste it in my browser it also works as expected. Seems like there is something happening to the request specifically when it is coming from cloudflares worker and I can't figure out what it is
6 Replies
is the API key hardcoded in your code?
I tried it as an environment variable and had coded
Hmm, did you add the env variable from cli/dashboard to cf worker in the first case?
Yes
Weird
@jprather can you turn off the locale mode with wrangler, and then try to use it(on your machine)
To see if request will fail or not
I did that as well. Runs fine local but when it's tunneling to cloudflare it fails