Skip to content

Commit 7a6ac33

Browse files
committed
UBERF-7865: Fix wrong access to not created collection (#6315)
Signed-off-by: Andrey Sobolev <[email protected]>
1 parent 2209062 commit 7a6ac33

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

Diff for: dev/docker-compose.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ services:
6262
- LAST_NAME_FIRST=true
6363
- ACCOUNTS_URL=http://localhost:3000
6464
- BRANDING_PATH=/var/cfg/branding.json
65+
- INIT_SCRIPT_URL=https://raw.githubusercontent.com/hcengineering/init/main/script.yaml
66+
- INIT_WORKSPACE=onboarding
6567
restart: unless-stopped
6668
collaborator:
6769
image: hardcoreeng/collaborator

Diff for: pods/account/src/__start.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const disabled = (process.env.MODEL_DISABLED ?? '').split(',').map((it) => it.tr
1616
const txes = JSON.parse(JSON.stringify(builder(enabled, disabled).getTxes())) as Tx[]
1717

1818
configureAnalytics(process.env.SENTRY_DSN, {})
19-
Analytics.setTag('application', 'transactor')
19+
Analytics.setTag('application', 'account')
2020

2121
const metricsContext = new MeasureMetricsContext(
2222
'account',

Diff for: server/core/src/server/domainHelper.ts

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export class DomainIndexHelperImpl implements DomainHelper {
174174
}
175175
}
176176
} catch (err: any) {
177+
ctx.error('error during domain collections/indexes check', { domain, error: err })
177178
Analytics.handleError(err)
178179
}
179180

Diff for: server/mongo/src/utils.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@ export class DBCollectionHelper implements DomainHelperOperations {
230230
}
231231

232232
async estimatedCount (domain: Domain): Promise<number> {
233-
const c = this.collection(domain)
234-
return await c.estimatedDocumentCount()
233+
if (this.exists(domain)) {
234+
const c = this.collection(domain)
235+
return await c.estimatedDocumentCount()
236+
}
237+
return 0
235238
}
236239
}

0 commit comments

Comments
 (0)