Skip to content

Successful insert op returns array of nulls (or whatever the primary key was set to in the request) in inserted_hashes array #30

@cap10morgan

Description

@cap10morgan

The insert operation, when successful, is supposed to return the set of newly-created primary keys (still called "hashes" here; but that's a separate issue) in an array under the inserted_hashes key in the response object.

However, it currently just returns an array of null (or whatever the primary key attribute was set to in the request, see the -patch-2 attachment for another failing integration test); one for each successfully-inserted record.

I've attached a patch to one of our integration tests that causes it to start failing on this bug.

The fix wasn't immediately obvious to me looking at the relevant source code in (I think) the upsertRecords method of the ResourceBridge class. Conceptually it seems pretty clear we're pulling it out of a data structure that represents the request for inserts (not updates, since this is upsert code), but it wasn't obvious what the correct thing to change it to was. The Table.create(...) call that claims to return a Promise<Id> was not returning that (I was seeing something like Account {} returned from the resolved promise).

I found this while investigating why our k6 insertRead.js performance test was never executing any reads.

failing-insert-integration-test.patch

failing-insert-integration-test-2.patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions