[web] throw early in UserCreator.createNewUser with missing analyticsId (#34664)

* [web] throw early in UserCreator.createNewUser with missing analyticsId

* [migrations] rerun back-fill of db.users.analyticsId

GitOrigin-RevId: eabf16326192fca4dbea00ad643cee4315c426c6
This commit is contained in:
Jakob Ackermann
2026-06-17 08:06:59 +00:00
committed by Copybot
parent 6bc9f1dae4
commit d44e862a0c
11 changed files with 117 additions and 34 deletions
@@ -14,6 +14,7 @@ import OError from '@overleaf/o-error'
import fs from 'node:fs'
import Path from 'node:path'
import { fileURLToPath } from 'node:url'
import crypto from 'node:crypto'
const MONOREPO = Path.dirname(
Path.dirname(Path.dirname(Path.dirname(fileURLToPath(import.meta.url))))
@@ -42,6 +43,7 @@ async function createUser(
const user = await UserRegistrationHandler.promises.registerNewUser({
email,
password: PASSWORD,
analyticsId: crypto.randomUUID(),
})
userId = user._id
} catch (err) {
+2
View File
@@ -11,6 +11,7 @@ import UserDeleter from '../app/src/Features/User/UserDeleter.mjs'
import UserRegistrationHandler from '../app/src/Features/User/UserRegistrationHandler.mjs'
import HistoryManager from '../app/src/Features/History/HistoryManager.mjs'
import ProjectCreationHandler from '../app/src/Features/Project/ProjectCreationHandler.mjs'
import crypto from 'node:crypto'
const MONOREPO = Path.dirname(
Path.dirname(Path.dirname(Path.dirname(fileURLToPath(import.meta.url))))
@@ -24,6 +25,7 @@ async function createUser(email) {
const user = await UserRegistrationHandler.promises.registerNewUser({
email,
password: process.env.CYPRESS_DEFAULT_PASSWORD,
analyticsId: crypto.randomUUID(),
})
const features = email.startsWith('free+')
? Settings.defaultFeatures