APIs & Integrations

Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Batch update custom objects working in postman but not in serverless

Hey Community,

 

We're trying to update a bacth of 55 custom objects.

 

We can successfully hit the endpoint with postman and get the expected results, but when using an identical request serverless function we're returning a 415 Unsupported Media Type error.

 

The body of the post request:

{ "inputs": [ { "properties": { "the_property": true }, "id": "123" }, { "properties": { "the_property": true }, "id": "456" }, { "properties": { "the_property": true }, "id": "789" }, ... ] } 

What we've tried:

  • Smaller batches
  • Double checked the headers
  • Made sure the body is stringified correctly
  • Using the Hubspot client
    • This returns a "update is not a function of undefined"

       

      Has anyone delt with a similar issue before?

      @CDow

 


 

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
5 Replies 5
JOConnell2
Participant

Batch update custom objects working in postman but not in serverless

@Kevin-C  Did you ever get this resolved? I am currently hitting the same issue.  I copy the body of the request to Postman and it works right away but when using the client library (Javascript) in a custom code workflow it seems to ignore the body of my request

 

Request:

{
    "inputs": [
        {
            "id": "1234567",
            "properties": {
                "prop1": "value1",
                "prop2": "value2",
                "prop3": "value3"
            },
            "createdAt": "2021-08-11T03:56:03.086Z",
            "updatedAt": "2022-06-10T03:44:23.034Z",
            "archived": false
        }
    ]
}

 

Response:

{"response":{"statusCode":200,"body":{"status":"COMPLETE","results":[],"startedAt":"2022-11-01T19:08:50.246Z","completedAt":"2022-11-01T19:08:50.246Z"}

 

0 Upvotes
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Batch update custom objects working in postman but not in serverless

@JOConnell2 I did not I believ we went another route 😞

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
0 Upvotes
SJaeger
Contributor | Platinum Partner
Contributor | Platinum Partner

Batch update custom objects working in postman but not in serverless

Which api url do you use? Which function of client in serverless 

Nothing is impossible
0 Upvotes
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Batch update custom objects working in postman but not in serverless

Hey @SJaeger 

Endpint: /crm/v3/objects/{objectType}/batch/update

 

The funciton that hits the bacth end point is the serverless part.

 

We're using a pretty standard implementation

Front-end:

  • collect required data
  • Pass to serverless

    Serverless:

    • hit the HS endpoint
    • return response

      Front-end:

      • Handle response

@SJaeger

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Batch update custom objects working in postman but not in serverless

Hey, @Kevin-C 👋 Fancy seeing you on the question—side of the fence 😊

 

I'm going to tag in @louischausse @SJaeger @piersg @stefen and see if we can get some additional eyes — and brains — for your question.

 

Thank you very much!  — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes