validateFirebaseProjectId static method
void
validateFirebaseProjectId(})
Rejects a Worker entrypoint pinned to a different Firebase project.
Runtime expressions such as resolveFirebaseProjectId(env) remain valid.
Implementation
static void validateFirebaseProjectId(
String source,
String projectId, {
String path = cloudflareEdgeEntryPath,
}) {
for (final functionName in [
"m.FirebaseAuthAdapter",
"auth.Functions.deleteUser",
]) {
final pattern = RegExp(
"${RegExp.escape(functionName)}\\s*\\(\\s*\\{\\s*projectId\\s*:\\s*['\"]([^'\"]+)['\"]",
);
for (final match in pattern.allMatches(source)) {
if (match.group(1) != projectId) {
throw StateError(
"$path pins $functionName to a different Firebase project. "
"Use a runtime environment-based project ID before applying or deploying this flavor.",
);
}
}
}
}