I am trying to integrate into my code an async library function. It works fine as:
client.checkPermission(checkPermissionRequest, (err, response) => {
if (err || response?.permissionship !== HAS_PERMISSION) {
const e = err || new Error('You do not have access to event:', id);
res.code(404).send({ error: e });
}
});
I want to rewrite it in an "await form" and this does not work. I have been trying:
const response = await client.checkPermission(checkPermissionRequest);
When I run the await code, it fails with: Error: Incorrect arguments passed
.
Why could this be happening and how could I fix this?