diff --git a/ui/admin/app/controllers/scopes/scope/session-recordings/index.js b/ui/admin/app/controllers/scopes/scope/session-recordings/index.js index ee4b8092b..6d9f05688 100644 --- a/ui/admin/app/controllers/scopes/scope/session-recordings/index.js +++ b/ui/admin/app/controllers/scopes/scope/session-recordings/index.js @@ -6,7 +6,7 @@ export default class ScopesScopeSessionRecordingsIndexController extends Control * @type {boolean} */ get hasSessionRecordings() { - return this.model.sessionRecordings.length > 0; + return this.model?.sessionRecordings?.length; } /** @@ -14,6 +14,6 @@ export default class ScopesScopeSessionRecordingsIndexController extends Control * @type {boolean} */ get hasSessionRecordingsConfigured() { - return this.model.storageBuckets.length > 0; + return this.model?.storageBuckets?.length; } } diff --git a/ui/admin/app/routes/scopes/scope/session-recordings.js b/ui/admin/app/routes/scopes/scope/session-recordings.js index e18a61020..4715a8a71 100644 --- a/ui/admin/app/routes/scopes/scope/session-recordings.js +++ b/ui/admin/app/routes/scopes/scope/session-recordings.js @@ -23,18 +23,28 @@ export default class ScopesScopeSessionRecordingsRoute extends Route { * @return {{sessionRecordings: Array, storageBuckets: Array}} */ async model() { + let storageBuckets; + const scope = this.modelFor('scopes.scope'); - // if (this.can.can('list session-recording', scope, { collection: 'session-recordings' })) { const { id: scope_id } = scope; + // if (this.can.can('list session-recording', scope, { collection: 'session-recordings' })) { const sessionRecordings = await this.store.query('session-recording', { scope_id, recursive: true, }); - const storageBuckets = await this.store.query('storage-bucket', { - scope_id, - recursive: true, - }); + + // Storage buckets could fail for a number of reasons, including that + // the user isn't authorized to access them. + try { + storageBuckets = await this.store.query('storage-bucket', { + scope_id, + recursive: true, + }); + } catch (e) { + // no op + } + return { sessionRecordings, storageBuckets, diff --git a/ui/admin/app/routes/scopes/scope/session-recordings/session-recording.js b/ui/admin/app/routes/scopes/scope/session-recordings/session-recording.js index 7945ba9d1..8e28a9802 100644 --- a/ui/admin/app/routes/scopes/scope/session-recordings/session-recording.js +++ b/ui/admin/app/routes/scopes/scope/session-recordings/session-recording.js @@ -26,12 +26,17 @@ export default class ScopesScopeSessionRecordingsSessionRecordingRoute extends R 'session-recording', session_recording_id ); - if (sessionRecording.target?.storage_bucket_id) { - const { storage_bucket_id } = sessionRecording.target; - storageBucket = await this.store.findRecord( - 'storage-bucket', - storage_bucket_id - ); + + try { + if (sessionRecording.target?.storage_bucket_id) { + const { storage_bucket_id } = sessionRecording.target; + storageBucket = await this.store.findRecord( + 'storage-bucket', + storage_bucket_id + ); + } + } catch (e) { + // no op } const sortedConnections = sessionRecording.connection_recordings .sortBy('start_time')