Skip to content

Commit

Permalink
UBERF-7865: Fix wrong access to not created collection (#6315)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <[email protected]>
  • Loading branch information
haiodo committed Aug 11, 2024
1 parent 2209062 commit 7a6ac33
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ services:
- LAST_NAME_FIRST=true
- ACCOUNTS_URL=http://localhost:3000
- BRANDING_PATH=/var/cfg/branding.json
- INIT_SCRIPT_URL=https://raw.githubusercontent.com/hcengineering/init/main/script.yaml
- INIT_WORKSPACE=onboarding
restart: unless-stopped
collaborator:
image: hardcoreeng/collaborator
Expand Down
2 changes: 1 addition & 1 deletion pods/account/src/__start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const disabled = (process.env.MODEL_DISABLED ?? '').split(',').map((it) => it.tr
const txes = JSON.parse(JSON.stringify(builder(enabled, disabled).getTxes())) as Tx[]

configureAnalytics(process.env.SENTRY_DSN, {})
Analytics.setTag('application', 'transactor')
Analytics.setTag('application', 'account')

const metricsContext = new MeasureMetricsContext(
'account',
Expand Down
1 change: 1 addition & 0 deletions server/core/src/server/domainHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export class DomainIndexHelperImpl implements DomainHelper {
}
}
} catch (err: any) {
ctx.error('error during domain collections/indexes check', { domain, error: err })
Analytics.handleError(err)
}

Expand Down
7 changes: 5 additions & 2 deletions server/mongo/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ export class DBCollectionHelper implements DomainHelperOperations {
}

async estimatedCount (domain: Domain): Promise<number> {
const c = this.collection(domain)
return await c.estimatedDocumentCount()
if (this.exists(domain)) {
const c = this.collection(domain)
return await c.estimatedDocumentCount()
}
return 0
}
}

0 comments on commit 7a6ac33

Please sign in to comment.