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

OpenAI API 403 Error from GCP asia-northeast3 Region - IP Geolocation Issue

Issue Summary

I'm experiencing a sudden 403 error when calling OpenAI API from Google Cloud Run functions deployed in the asia-northeast3 region. This issue started appearing a few days ago, while the same setup was working perfectly before.

Error Details

 

Error code: 403 - {'error': {'code': 'unsupported_country_region_territory', 'message': 'Country, region, or territory not supported', 'param': None, 'type': 'request_forbidden'}}

Environment

  • Service: Google Cloud Run
  • Region: asia-northeast3 (Seoul)
  • Zone: asia-northeast3-1
  • Function: Python function calling OpenAI API
  • Previous Status: Working normally until a few days ago

Root Cause Analysis

After debugging, I discovered that the IP address 34.96.43.150 (used by GCP zone asia-northeast3-1) is being identified as a Hong Kong IP by geolocation services. Since OpenAI API blocks requests from Hong Kong, this causes the 403 error despite South Korea being officially supported by OpenAI.

Questions

  1. Has anyone else experienced similar geolocation issues with asia-northeast3 region?
  2. Is this a known issue with IP address allocation in this region?
  3. Are there any recommended workarounds besides switching regions?
  4. Should I report this as a potential infrastructure issue to Google Cloud Support?

Temporary Solution

Planning to migrate to a different region (possibly asia-northeast1 or asia-southeast1) to resolve this issue.

Additional Context

  • OpenAI API officially supports South Korea
  • The issue appears to be related to IP geolocation detection rather than actual geographic restrictions
  • This affects production services that were previously stable

Has anyone encountered similar issues with other regions or third-party APIs? Any insights would be greatly appreciated.

Solved Solved
0 5 705
1 ACCEPTED SOLUTION

Hi @Ashuro,

Welcome to Google Cloud Community!

  1. Has anyone else experienced similar geolocation issues with the asia-northeast3 region?

    Yes, while not directly tied to the asia-northeast3 region, there are related discussions confirming the persistence of the ‘unsupported_country_region_territory’ error. On platforms like Server Fault and Stack Overflow, users have reported that Google Cloud IPs are often misgeolocated. Although some of these reports are outdated, they may still provide helpful insights.

  2. Is this a known issue with IP address allocation in this region?

    This is a known issue caused by differences in how IP geolocation data is sourced and maintained. Google Cloud Platform’s (GCP) IP geolocation uses their own methods, while third-party services like OpenAI rely on external databases that may misclassify some IPs. So, IPs in asia-northeast3 might sometimes appear as from other regions (like Hong Kong) to those services, leading to access issues.

  3. Are there any recommended workarounds besides switching regions?

  • VPC Access Connector with Cloud NAT for Static Egress IP: This involves configuring your Cloud Run service to route all outbound traffic through a Virtual Private Cloud (VPC) network with a Cloud NAT gateway that uses one or more reserved static external IP addresses. The result is that your traffic originates from a controlled and regionally-specific IP address; however this does not directly guarantee external geolocation services will always reflect the chosen region. Third party geolocation services may still misclassify some IPs.
  • Proxy Service with Controlled Egress: You can deploy a dedicated, lightweight proxy service within a VPC subnet that is configured with Cloud NAT and a static external IP. Other Cloud Run services can then be configured to forward only their OpenAI API calls (or other geo-sensitive traffic) to this internal proxy, offering more granular control.
  1. Should I report this as a potential infrastructure issue to Google Cloud Support?

    Based on the Google cloud documentation, it states that:

    “Google proprietary IP geolocation technology uses a combination of networking data and other inputs and methods to provide IP address location and network resolution for our users. Other organizations may use different signals or methods, which might occasionally lead to different results. If cases arise in which you experience an inconsistency in IP geolocation results that Google provides, please open a customer support case, so that we can investigate and, if appropriate, correct our records moving forward.”

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

5 REPLIES 5

Hi @Ashuro,

Welcome to Google Cloud Community!

  1. Has anyone else experienced similar geolocation issues with the asia-northeast3 region?

    Yes, while not directly tied to the asia-northeast3 region, there are related discussions confirming the persistence of the ‘unsupported_country_region_territory’ error. On platforms like Server Fault and Stack Overflow, users have reported that Google Cloud IPs are often misgeolocated. Although some of these reports are outdated, they may still provide helpful insights.

  2. Is this a known issue with IP address allocation in this region?

    This is a known issue caused by differences in how IP geolocation data is sourced and maintained. Google Cloud Platform’s (GCP) IP geolocation uses their own methods, while third-party services like OpenAI rely on external databases that may misclassify some IPs. So, IPs in asia-northeast3 might sometimes appear as from other regions (like Hong Kong) to those services, leading to access issues.

  3. Are there any recommended workarounds besides switching regions?

  • VPC Access Connector with Cloud NAT for Static Egress IP: This involves configuring your Cloud Run service to route all outbound traffic through a Virtual Private Cloud (VPC) network with a Cloud NAT gateway that uses one or more reserved static external IP addresses. The result is that your traffic originates from a controlled and regionally-specific IP address; however this does not directly guarantee external geolocation services will always reflect the chosen region. Third party geolocation services may still misclassify some IPs.
  • Proxy Service with Controlled Egress: You can deploy a dedicated, lightweight proxy service within a VPC subnet that is configured with Cloud NAT and a static external IP. Other Cloud Run services can then be configured to forward only their OpenAI API calls (or other geo-sensitive traffic) to this internal proxy, offering more granular control.
  1. Should I report this as a potential infrastructure issue to Google Cloud Support?

    Based on the Google cloud documentation, it states that:

    “Google proprietary IP geolocation technology uses a combination of networking data and other inputs and methods to provide IP address location and network resolution for our users. Other organizations may use different signals or methods, which might occasionally lead to different results. If cases arise in which you experience an inconsistency in IP geolocation results that Google provides, please open a customer support case, so that we can investigate and, if appropriate, correct our records moving forward.”

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.

I'm from South Korea and having the same issue.
I'm using gcp with asia-northeast3-a and my ip external address is 34.64.58.201.
When I checked the IP's geolocation, it says Seoul, but strangely I keep getting the same 403 error:

Unexpected error: Error code: 403 - {'error': {'code': 'unsupported_country_region_territory', 'message': 'Country, region, or territory not supported', 'param': None, 'type': 'request_forbidden'}}

Did you resolve this issue? Please let me know if migrating to a different zone works.

Unfortunately, I have not received paid support yet, so the issue hasn’t been resolved. It continues to recur intermittently. Currently, we are handling it by reconnecting to GCP and retrying after a certain interval whenever the error occurs.

The OpenAI support team says that the issue is fixed. My app is finally working fine now. 
https://community.openai.com/t/cloud-run-in-asia-northeast3-suddenly-getting-unsupported-country-reg...

That's great. Thank you for sharing the information.