Google Cloud Platform integration is not working

Spent two weeks deleting and recreating the webhook and each time I get a 400 error when I click “test” in the console:

error status 400 from pubsub.googleapis.com

The trigger and response code is in the firmware.

Does anyone have a solution?

HTTP/1.1 400 Bad Request
Vary: X-Origin
Vary: Referer
Content-Type: application/json; charset=UTF-8
Date: Sun, 28 May 2017 01:16:39 GMT
Server: ESF
Cache-Control: private
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked

`{ "error": { "code": 400, "message": "Invalid value at 'messages[0].attributes[3].value' (TYPE_STRING), 0", "status": "INVALID_ARGUMENT", "details": [{ "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [{ "field": "messages[0].attributes[3].value", "description": "Invalid value at 'messages[0].attributes[3].value' (TYPE_STRING), 0" }] }] } }`

@jeiden or someone please help, this is for a product I am launching and need to store the data for customers to view.

You may also want to show the webhook design and the trigger event to provide a full picture, since the error suggests a problem in the payload.

Hi dancingpearl, Hi Scruff,
Currently I also got stuck with the same exact problem(same trigger and response ). Recreating new Integrations is not helping, I can able to see the events in Particle Event Logs but not in GCP Datastore :pensive:…needed help! Please help!

one of the trigger event i used in code,

Particle.publish(“EMERGENCY-ALERTS”,“Water_NIL_Fault”,60,PRIVATE);

payload that I can see in Event Logs, Details:
{
“data”:“Water_NIL_Fault”,
“ttl”:60,
“published_at”:“2017-05-8T12:23:01.480Z”,
“coreid”:“490047000xxxxxxxxxxxxxxx”,
“userid”:“5857a0c01xxxxxxxxxxxxxxx”,
“version”:0,
“public”:false,
“productID”:33xx,
“name”:“EMERGENCY-ALERTS”
}

Thanks in advance…

Added Some Screenshots for details…

I created an entirely new one from scratch:

Enabled API & Created the Pub/Sub

Created the Particle integration
I even did a version where the box “Only the device that triggers the integration should receive its response” is unchecked and same results.

I test the integration and it fails

Here are all the errors:

Error Message

error status 400 from pubsub.googleapis.com

Event

{
  "name": "Battery Status",
  "data": "test-event",
  "ttl": 60,
  "published_at": "2017-05-28T16:32:59.954Z",
  "coreid": "api",
  "userid": "XXXXXXXXXXXXXXXXXXXXXXXX",
  "version": 0,
  "public": false,
  "productID": XXX
}

Request

POST /v1/projects/particle-169016/topics/product:publish HTTP/1.1
User-Agent: ParticleBot/1.1 (https://docs.particle.io/tutorials/integrations/google-cloud-platform/)
Authorization: Bearer <redacted>
host: pubsub.googleapis.com
accept: application/json
content-type: application/json
content-length: 157
Connection: keep-alive

Response

HTTP/1.1 400 Bad Request
Vary: X-Origin
Vary: Referer
Content-Type: application/json; charset=UTF-8
Date: Sun, 28 May 2017 16:33:00 GMT
Server: ESF
Cache-Control: private
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked

{"error":{"code":400,"message":"Invalid value at 'messages[0].attributes[3].value' (TYPE_STRING), 0","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"messages[0].attributes[3].value","description":"Invalid value at 'messages[0].attributes[3].value' (TYPE_STRING), 0"}]}]}}

I found on GCP, https://cloud.google.com/storage/docs/json_api/v1/status-codes, something that references what the 400 error code might mean:

invalidAltValue: The value for the alt URL parameter was not recognized.

I am unsure how to research this issue further…

Hey everyone (@dancingpearl @micrologix),

Thank you very much for bringing this to our attention. So sorry you were running into this problem. We just released a fix for this. Can you please try again and let us know if the issue persists? This was nothing that you did wrong – it was a bug on our end, simply around not converting the data of the payload to a string correctly as GCP requires.

You should be good to go now. I appreciate your patience and hope you are fully unblocked now!

Happy Building,
Jeff

2 Likes

5 years later I have the exact same error, but it’s happening only occasionally, less than 1% of the time. Unfortunately in those cases, there does not seem any retry so the data is lost.

Below is the full Response from GCP on one of those errors.
Please help

HTTP/1.1 400 Bad Request
Vary: X-Origin
Vary: Referer
Content-Type: application/json; charset=UTF-8
Date: Tue, 28 Jun 2022 15:57:34 GMT
Server: ESF
Cache-Control: private
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked

{"error":{"code":400,"message":"Invalid value at 'messages[0].attributes[3].value' (TYPE_STRING), 0","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"messages[0].attributes[3].value","description":"Invalid value at 'messages[0].attributes[3].value' (TYPE_STRING), 0"}]}]}}