1

I am looking to create a GCP Cloud API Gateway resource for my project. I have created the API and also created the API config. I am now looking to create the Gateway itself. However, when I run the Gateway creation command I get the following error:

gcloud beta api-gateway gateways create project-api-gateway --api=project-api --api-config=project-config --location=us-central1

Waiting for API Gateway [project-api-gateway] to be created with [projects/${MY_PROJECT}/locations/global/apis/project-api/configs/project-config] config...failed. ERROR: (gcloud.beta.api-gateway.gateways.create) an internal error has occurred

The same happens when I try and do this through the cloud console and creating the API gateway through terraform. Anyone know what's going wrong here?

The API and API config were created through terraform, but I believe the equivalent creation commands are:

gcloud beta api-gateway apis create project-api --project= gcloud beta api-gateway api-configs create project-config
--api=project-api --openapi-spec=swagger.yaml
--project= --backend-auth-service-account=SERVICE_ACCOUNT_EMAIL

EDIT: As request, the command run with debug turned on (and slightly redacted):

gcloud beta api-gateway gateways create project-api-gateway \
  --api=project-api --api-config=project-config \
  --location=europe-west1 --verbosity=debug
DEBUG: Running [gcloud.beta.api-gateprojectway.gateways.create] with arguments: [--api: "project-api", --api-config: "project-config", --location: "europe-west1", --verbosity: "debug", GATEWAY: "project-api-gateway"]
DEBUG: Making request: POST https://www.googleapis.com/oauth2/v4/token
Waiting for API Gateway [project-api-gateway] to be created with [projects/project-prd-f4be/locations/global/apis/project-api/configs/project-config] config...failed.
DEBUG: (gcloud.beta.api-gateway.gateways.create) an internal error has occurred
Traceback (most recent call last):
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/googlecloudsdk/calliope/cli.py", line 983, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/googlecloudsdk/calliope/backend.py", line 808, in Run
    resources = command_instance.Run(args)
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/surface/api_gateway/gateways/create.py", line 66, in Run
    return operations_util.PrintOperationResult(
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/googlecloudsdk/command_lib/api_gateway/operations_util.py", line 67, in PrintOperationResult
    return op_client.WaitForOperation(operation_ref, wait_string, service)
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/googlecloudsdk/api_lib/api_gateway/operations.py", line 89, in WaitForOperation
    return waiter.WaitFor(poller, operation_ref, message)
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/googlecloudsdk/api_lib/util/waiter.py", line 261, in WaitFor
    operation = PollUntilDone(
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/googlecloudsdk/api_lib/util/waiter.py", line 322, in PollUntilDone
    operation = retryer.RetryOnResult(
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/googlecloudsdk/core/util/retry.py", line 229, in RetryOnResult
    if not should_retry(result, state):
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/googlecloudsdk/api_lib/util/waiter.py", line 320, in _IsNotDone
    return not poller.IsDone(operation)
  File "/Users/Person/Downloads/google-cloud-sdk 2/lib/googlecloudsdk/api_lib/util/waiter.py", line 122, in IsDone
    raise OperationError(operation.error.message)
googlecloudsdk.api_lib.util.waiter.OperationError: an internal error has occurred
ERROR: (gcloud.beta.api-gateway.gateways.create) an internal error has occurred

API can be found at http://www.filedropper.com/swagger_1

  • Have you recently deleted a gateway? Can you also post your API config? Lastly, can you add `--verbosity=debug` parameter for a more detailed error message? – Alex G Nov 17 '20 at 06:30
  • Make sure that you are using the same service account from the API config creation. – Alex G Nov 17 '20 at 06:53
  • I have seen this issue both before and after deleting a gateway. I've added the detailed error message and the API config. Any help would be much appreciated. – Robbie Heywood Nov 18 '20 at 20:40
  • Can you try to limit the config id to 36 characters only and see if it will get the same error? – Alex G Dec 17 '20 at 10:09

0 Answers0