Skip to content

Commit a5a05f0

Browse files
committed
Fix init flow to allow choosing a free instance on repeated inits on spark accounts
1 parent bdd64c8 commit a5a05f0

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/init/features/dataconnect/index.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -703,12 +703,6 @@ async function promptForCloudSQL(setup: Setup, info: RequiredInfo): Promise<void
703703
"dataconnect",
704704
"CloudSQL no cost trial has already been used on this project.",
705705
);
706-
if (!billingEnabled) {
707-
setup.instructions.push(
708-
upgradeInstructions(setup.projectId || "your-firebase-project", true),
709-
);
710-
return;
711-
}
712706
} else if (instrumentlessTrialEnabled || billingEnabled) {
713707
logLabeledSuccess("dataconnect", "CloudSQL no cost trial available!");
714708
}
@@ -729,7 +723,11 @@ async function promptForCloudSQL(setup: Setup, info: RequiredInfo): Promise<void
729723
if (freeTrialAvailable) {
730724
choices.push({ name: "Create a new free trial instance", value: "", location: "" });
731725
} else {
732-
choices.push({ name: "Create a new CloudSQL instance", value: "", location: "" });
726+
choices.push({
727+
name: `Create a new CloudSQL instance${billingEnabled ? "" : " (requires billing account)"}`,
728+
value: "",
729+
location: "",
730+
});
733731
}
734732
info.cloudSqlInstanceId = await select<string>({
735733
message: `Which CloudSQL instance would you like to use?`,
@@ -741,6 +739,12 @@ async function promptForCloudSQL(setup: Setup, info: RequiredInfo): Promise<void
741739
info.locationId = choices.find((c) => c.value === info.cloudSqlInstanceId)!.location;
742740
} else {
743741
info.flow += "_pick_new_csql";
742+
if (!billingEnabled && freeTrialUsed) {
743+
setup.instructions.push(
744+
upgradeInstructions(setup.projectId || "your-firebase-project", true),
745+
);
746+
return;
747+
}
744748
info.cloudSqlInstanceId = await input({
745749
message: `What ID would you like to use for your new CloudSQL instance?`,
746750
default: newUniqueId(

0 commit comments

Comments
 (0)