After analysing the output of the cURL request, we can see the unsupported type is an input parameter to the upsertState
function, which has been in my SDK for a while: Full function declaration:
@Query({ apiName: "upsertState" })
@ExternalSystems({ sources: [FoundryApis, Slack, OpenAICodeStrapEng] })
@Trace({
resource: {
service_name: 'vickie',
service_instance_id: 'production',
telemetry_sdk_name: 'xreason-functions',
telemetry_sdk_version: '7.0.2',
host_hostname: 'REDACTED',
host_architecture: 'prod',
},
operationName: 'upsertState',
kind: 'Server',
samplingDecision: 'RECORD_AND_SAMPLE',
samplingRate: 1.0,
attributes: { endpoint: '/api/v2/ontologies/ontology-c0c8a326-cd0a-4f69-a575-b0399c04b74d/queries/upsertState/execute' }
})
public async upsertState(
plan?: string,
forward: boolean = true,
executionId?: string,
inputs: string = '{}',
xreason: string = SupportedEngines.COMS,
// We pass machine execution because of this issue:
// https://community.palantir.com/t/is-there-an-eventually-consistency-problem-in-the-ontology-when-executing-fetch-vs-edits/4015/2 // it can be removed if that issue is ever solved
machineExecution?: MachineExecutions): Promise<MachineExecutions> {...}
I am 90% sure it’s this parameter: machineExecution?: MachineExecutions
that is throwing it off. I had to add that parameter recently as a workaround to an eventual consistency problem, which you can read about here: https://community.palantir.com/t/is-there-an-eventually-consistency-problem-in-the-ontology-when-executing-fetch-vs-edits/4015/1. So, I introduced this parameter to pass the updated object directly, and that is when things started breaking.
I see that OntologyEdits
is an unsupported parameter type for TypeScript functions:
- Principal User
- Notification
- OntologyEdit
- ClassificationMarking
In my case, I do read and edit an ontology object, then pass it to the upsertState function to get around the eventual consistency issue. I assume that is what is causing the OSDK generation to fail (assuming that’s what OntologyEdit is).
The challenge I am now facing is how to handle cases where I need to read after write. If the OSDK can’t support passing the object as a parameter to this function I may have to create a separate function that copies the behavior of the original until this read after write issue is figured out.