Model SDK: Error: Invalid container ID: undefined

0
When loading large units with the Mendix model SDK, I regularly receive the following error: C:\app\node_modules\mendixmodelsdk\dist\sdk\internal\abstract-model.js:274 throw new Error("Invalid container ID: " + containerId); ^ Error: Invalid container ID: undefined at Model.AbstractModel._resolveContainer (C:\app\node_modules\mendixmodelsdk\dist\sdk\internal\abstract-model.js:274:19) at C:\app\node_modules\mendixmodelsdk\dist\sdk\internal\abstract-model.js:213:23 at executeAction (C:\app\node_modules\mobx\lib\mobx.js:915:19) at Object.runInAction (C:\app\node_modules\mobx\lib\mobx.js:1161:12) at Object.callback (C:\app\node_modules\mendixmodelsdk\dist\sdk\internal\abstract-model.js:211:20) at C:\app\node_modules\mendixmodelsdk\dist\sdk\internal\model-server-client.js:248:30 at Request._callback (C:\app\node_modules\mendixmodelsdk\dist\sdk\internal\transportation.js:148:17) at Request.self.callback (C:\app\node_modules\request\request.js:186:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) The promise I use to load the domain model is not rejected, and when I add a try/catch block, the error is not caught. So currently I am not able to handle this error and my application basically hangs.   I'd like to know what causes this error, how to prevent it, and how to handle it (catch it, reject the load promise) so that my application does not crash.   I am using mendixmodelsdk version 4.8.0 and mendixplatformsdk version 4.0.0. I test this with a mendix 6.2.1 application, and I try to load a single domain model with 389 entities and 764 associations. The error does not always occur. It occurs more often when I try to load more than 1 domain model in the application.   import { MendixSdkClient, Project, loadAsPromise } from "mendixplatformsdk"; const client = new MendixSdkClient(process.env.mendixUsername, process.env.mendixApiKey); const project = new Project(client, "id", "name"); project.createWorkingCopy().then(workingCopy => { console.log("Working copy Mendix version: " + workingCopy.model().mxVersionForModel.toString()); return loadAsPromise(workingCopy.model().allDomainModels().filter(dm => dm.containerAsModule.name == "module name")[0]); }).then(dm => { console.log("Loaded domain model"); }).catch(err => { console.log(err); });  
asked
0 answers