Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

fix projects list response parsing when no projects

ThieryMichele7d6b47293f6
diff --git a/scripts/supabase-remote-init.mjs b/scripts/supabase-remote-init.mjs
index 7e95dcee..1c75fcd4 100644
--- a/scripts/supabase-remote-init.mjs
+++ b/scripts/supabase-remote-init.mjs
@@ -161,7 +161,6 @@ async function selectRegion() {
}
async function waitForProjectToBeReady({ projectRef }) {
- console.log("Waiting for project to be ready...");
const { stdout } = await execa(
"npx",
["supabase", "projects", "list", "--output", "json"],
@@ -171,8 +170,9 @@ async function waitForProjectToBeReady({ projectRef }) {
);
try {
- // The response is an Array of objects
- const matchJSON = stdout.match(new RegExp("\\[.*\\]", "s"));
+ // The response is an Array of objects or null if there are no projects
+ const matchJSON =
+ stdout === null ? "[]" : stdout.match(new RegExp("\\[.*\\]", "s"));
if (!matchJSON) {
throw new Error("Invalid JSON output");
}