google-cloud-pubsubgoogle-cloud-runevent-arc

HTTP 500 for POST request to Cloud Run service with error "__GCP_CloudEventsMode=CE_PUBSUB_BINDING"


I've created an EventArc trigger for Compute Engine (beta.compute.instances.insert) that calls a GO application deployed to Cloud Run. It receives the JSON message and then saves the payload to database. The insert to database works fine but I get continuous errors that are talked in this StackOverFlow - GCP EventArc : Response Code 500 when using PubSub trigger with Cloud Run.

Error Log

{
  "insertId": "65b2da13000869483a1944dc",
  "httpRequest": {
    "requestMethod": "POST",
    "requestUrl": "https://****-****-w7pzzaieea-uc.a.run.app/event?__GCP_CloudEventsMode=CE_PUBSUB_BINDING",
    "requestSize": "3883",
    "status": 500,
    "responseSize": "610",
    "userAgent": "APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)",
    "remoteIp": "6.1.6.2",
    "serverIp": "2.29.6.53",
    "latency": "0.003452299s",
    "protocol": "HTTP/1.1"
  },
  "resource": {
    "type": "cloud_run_revision",
    "labels": {
      "revision_name": "eventarc-correl-00001-2rp",
      "project_id": "master-****-412315",
      "configuration_name": "eventarc-correl",
      "service_name": "eventarc-correl",
      "location": "us-central1"
    }
  },
  "timestamp": "2024-01-25T22:00:51.546070Z",
  "severity": "ERROR",
  "labels": {
    "instanceId": "0087599d420cbbaa6c1832b5f81208edf009255e203331f563e36d4a5727a0ba3f2ab0a764cbb8a720cdbf216989db81b4ef8dc7d97dc1890bd14d14a9ff157766b8"
  },
  "logName": "projects/master-****-412315/logs/run.googleapis.com%2Frequests",
  "trace": "projects/master-****-412315/traces/67b49b99a9bb4dffff96d4136f8aa9ab",
  "receiveTimestamp": "2024-01-25T22:00:51.557636656Z",
  "spanId": "13211753236440383207",
  "traceSampled": true
}

Solution

  • I was able to resolve this issue, turns out it was because of the incoming JSON request did not have a requisite field in the post.