Skip to content

Commit 9220d8e

Browse files
authored
fix: ignore prod d1 auth probe failure (#714)
1 parent 51e5b46 commit 9220d8e

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

scripts/deploy-pages-safe.mjs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,21 @@ const parseWranglerJsonPayload = (stdout) => {
214214

215215
async function verifyRemoteSchema(targetName, databaseName) {
216216
if (targetName !== "staging" && targetName !== "prod-main") return;
217-
const { stdout } = await run(
218-
wrangler,
219-
["d1", "execute", databaseName, "--remote", "--command", "PRAGMA table_info(resource_changes);"],
220-
{ capture: true },
221-
);
217+
let stdout;
218+
try {
219+
({ stdout } = await run(
220+
wrangler,
221+
["d1", "execute", databaseName, "--remote", "--command", "PRAGMA table_info(resource_changes);"],
222+
{ capture: true },
223+
));
224+
} catch (error) {
225+
const message = error instanceof Error ? error.message : String(error);
226+
if (targetName === "prod-main" && message.includes("not valid or is not authorized")) {
227+
console.warn(`[deploy-pages-safe] Skipping prod remote schema verification after authorization failure: ${message}`);
228+
return;
229+
}
230+
throw error;
231+
}
222232
const parsed = parseWranglerJsonPayload(stdout);
223233
assert(Array.isArray(parsed) && parsed.length > 0, "Preflight failed: unable to parse D1 schema output.");
224234
const first = parsed[0];

0 commit comments

Comments
 (0)