Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Configure an API Key for use in Cloud Run

I want to use the Google Geocoding service from a function in Claude Run, but it returns the REQUEST_DENIED error. How do I configure the API_KEY web side restriction to allow me to use it from Claude Run?

Solved Solved
0 1 560
1 ACCEPTED SOLUTION

Hi @gebejaranod,

Welcome to Google Cloud Community!

The REQUEST_DENIED error when using the Google Geocoding API from CLoud Run usually due to incorrect API key restrictions. HTTP Referrer restrictions, designed for browsers, will not work with server-side Cloud Run. To fix this, I would recommend any of the two options:

  1. IP Address Restrictions with a Static Outbound IP:  This method involves routing your Cloud Run's outbound traffic through a static external IP address. You'll need to:
  2. Service Accounts and Secret Manager: This more secure approach focuses on managing your API key's access rather than its network origin: 

This method enhances security by keeping your API key out of your code and deployment configurations.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

View solution in original post

1 REPLY 1

Hi @gebejaranod,

Welcome to Google Cloud Community!

The REQUEST_DENIED error when using the Google Geocoding API from CLoud Run usually due to incorrect API key restrictions. HTTP Referrer restrictions, designed for browsers, will not work with server-side Cloud Run. To fix this, I would recommend any of the two options:

  1. IP Address Restrictions with a Static Outbound IP:  This method involves routing your Cloud Run's outbound traffic through a static external IP address. You'll need to:
  2. Service Accounts and Secret Manager: This more secure approach focuses on managing your API key's access rather than its network origin: 

This method enhances security by keeping your API key out of your code and deployment configurations.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

Top Solution Authors