Skip to content

Commit 98714eb

Browse files
committed
fix excess erroring with user roles
1 parent 07ec5c0 commit 98714eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/api/functions/authorization.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ export async function getUserRoles(
2929
},
3030
});
3131
const response = await dynamoClient.send(command);
32-
if (!response || !response.Item) {
32+
if (!response) {
3333
throw new DatabaseFetchError({
3434
message: "Could not get user roles",
3535
});
3636
}
37+
if (!response.Item) {
38+
return [];
39+
}
3740
const items = unmarshall(response.Item) as { roles: AppRoles[] | ["all"] };
3841
if (!("roles" in items)) {
3942
return [];

0 commit comments

Comments
 (0)