This seems to correspond with what is said in the documentation of the API regarding creation of a batch of associations. One of the reasons I can think of this happens is beause the "from" key is set in the following way:
Creating batch of associations gives Invalid Input JSON error
I've been trying to get to the root of the problem. I created the following code:
const Hubspot = require('@hubspot/api-client');
const hubspot = new Hubspot.Client({ apiKey: 'API-KEY'});
var contact_associations_ = [{"from": {id: '8178324514'}, "to": {id:'550601'}, "type": 'deal_to_contact'}]
var inputs = {inputs: contact_associations_}
if(!contact_associations_.filter(input => !input.from.id)) {
throw new Error(`from.id missing in input: ${JSON.stringify(input)}`);
}
var response = await hubspot.crm.associations.batchApi.create('deal', 'contact', {inputs: contact_associations_});
The strange thing is that this code works fine and creates the association in Hubspot when I execute it directly from Visual Studio Code. However, running it from Pipedream or Localhost even, it gives the attributes not set error.