4 DEADLINE_EXCEEDED: Deadline exceeded when trying to insert records very rapidly into Datastore

We are using Firestore for Datastore and trying to bulk load data from CSV into Datastore. So we are making use of this API:

console.time(label);
let result = await this.datastore.upsert(entities); // insert or update if exists
console.timeEnd(label);
our batch size is 500 entities. After running for a minute or so we get:
4 DEADLINE_EXCEEDED: Deadline exceeded
How can we fix this?
0 1 2,693
1 REPLY 1

Have a look here, https://cloud.google.com/datastore/docs/concepts/limits on the section "Datastore Limits".

I'd split those entities first based on the limits.