diff --git a/src/entities/user.ts b/src/entities/user.ts index 19686ab9b..3cd9c64c8 100644 --- a/src/entities/user.ts +++ b/src/entities/user.ts @@ -221,8 +221,10 @@ export class User extends BaseEntity { @Field(_type => Boolean, { nullable: true }) get privadoVerified(): boolean { - return this.privadoVerifiedRequestIds.includes( - PrivadoAdapter.privadoRequestId, + return ( + this.privadoVerifiedRequestIds?.includes( + PrivadoAdapter.privadoRequestId, + ) ?? false ); } diff --git a/src/orm.ts b/src/orm.ts index 5e73e99c5..9625e97fd 100644 --- a/src/orm.ts +++ b/src/orm.ts @@ -46,7 +46,7 @@ export class AppDataSource { dropSchema, logger: 'advanced-console', logging: ['error'], - ssl: config.get('TYPEORM_DISABLE_SSL') === 'true' ? false : undefined, // use default in case it's not set + // ssl: config.get('TYPEORM_DISABLE_SSL') === 'true' ? false : undefined, // use default in case it's not set cache: isTestEnv ? false : { diff --git a/src/ormconfig.ts b/src/ormconfig.ts index fd8736fcd..6dcf3f990 100644 --- a/src/ormconfig.ts +++ b/src/ormconfig.ts @@ -28,7 +28,7 @@ const ormConfig: DataSourceOptions = { username: process.env.TYPEORM_DATABASE_USER, password: process.env.TYPEORM_DATABASE_PASSWORD, database: process.env.TYPEORM_DATABASE_NAME, - ssl: process.env.TYPEORM_DISABLE_SSL === 'true' ? false : undefined, // use default in case it's not set + // ssl: process.env.TYPEORM_DISABLE_SSL === 'true' ? false : undefined, // use default in case it's not set entities: getEntities(), migrations: ['migration/*.ts'], synchronize: process.env.NODE_ENV !== 'production', // Enable sync for test environments diff --git a/src/server/bootstrap.ts b/src/server/bootstrap.ts index 4a3bafeec..349c500b5 100644 --- a/src/server/bootstrap.ts +++ b/src/server/bootstrap.ts @@ -251,7 +251,10 @@ export async function bootstrap() { const { headers } = req; const authVersion = headers?.authversion || '1'; if (headers?.authorization) { - token = headers.authorization.split(' ')[1].toString(); + token = headers.authorization?.split(' ')[1].toString(); + if (!token) { + throw new Error('Authorization token is missing'); + } user = await authorizationHandler(authVersion as string, token); } }