Skip to content

Fix CI build failure: gracefully handle placeholder database_id in migrate.sh#27

Open
Copilot wants to merge 2 commits intomainfrom
copilot/fix-database-id-error
Open

Fix CI build failure: gracefully handle placeholder database_id in migrate.sh#27
Copilot wants to merge 2 commits intomainfrom
copilot/fix-database-id-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

wrangler.toml ships with database_id = "your_database_id_here" as a placeholder. In CI (where CLOUDFLARE_API_TOKEN or CF_PAGES is set), scripts/migrate.sh skips the local-dev bypass and calls wrangler d1 migrations apply --remote, which rejects the non-UUID value with Invalid property: databaseId => Invalid uuid [code: 7400], failing the build.

Changes

  • scripts/migrate.sh: Added pre-flight validation of database_id read from wrangler.toml before attempting remote migrations:
    • Exits 0 with a warning if the value is still the placeholder your_database_id_here or empty
    • Exits 0 with a warning if the value fails UUID format validation (regex accepts both upper- and lowercase hex)
    • Only proceeds to wrangler d1 migrations apply when a well-formed UUID is present
DATABASE_ID=$(grep 'database_id' wrangler.toml 2>/dev/null | head -1 | sed 's/.*=\s*"\([^"]*\)".*/\1/')
if [ -z "$DATABASE_ID" ] || [ "$DATABASE_ID" = "your_database_id_here" ]; then
    echo "⚠️  Warning: database_id is not configured in wrangler.toml"
    exit 0
fi
if ! echo "$DATABASE_ID" | grep -qE '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'; then
    echo "⚠️  Warning: database_id '$DATABASE_ID' is not a valid UUID"
    exit 0
fi

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@DonnieBLT DonnieBLT marked this pull request as ready for review February 23, 2026 00:54
Copilot AI review requested due to automatic review settings February 23, 2026 00:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 23, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
blt-api 6a87789 Feb 23 2026, 12:55 AM

Copilot AI changed the title [WIP] Fix database ID error in Cloudflare API request Fix CI build failure: gracefully handle placeholder database_id in migrate.sh Feb 23, 2026
Copilot AI requested a review from DonnieBLT February 23, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants