Randomly rejected promise
stianl opened this issue · 1 comments
stianl commented
Using Promise.all
with apiKeyMode
does not seem to work properly - one of the promises is always rejected.
This used to work fine when using client.loginWithApiKey()
in earlier versions of the SDK.
const client = new CogniteClient({
appId: 'Cognite SDK samples',
project,
getToken: () => Promise.resolve(apiKey),
apiKeyMode: true
});
const [eventCount, fileCount] = await Promise.all([
client.events.aggregate.count(filter),
client.files.aggregate(filter)
])
pedroharbs commented
Hey @stianl I've been testing this situation at the version 6.1.1 and the use of Promise.all with this functions work perfectly without any problems. You can pass the version that you are trying to implement this?