diff --git a/packages/backend-core/src/security/roles.ts b/packages/backend-core/src/security/roles.ts index cd9217d6008..2fcde768bc1 100644 --- a/packages/backend-core/src/security/roles.ts +++ b/packages/backend-core/src/security/roles.ts @@ -384,8 +384,8 @@ export async function getAllRoles(appId?: string): Promise { } async function shouldIncludePowerRole(db: Database) { - const app = await db.get(DocumentType.APP_METADATA) - const { creationVersion } = app + const app = await db.tryGet(DocumentType.APP_METADATA) + const creationVersion = app?.creationVersion if (!creationVersion) { // Old apps don't have creationVersion, so we should include it for backward compatibility return true