wrangler preview --json prints log lines before the JSON

·#cloudflare·#wrangler·#ci·

wrangler preview --json does not print only JSON: Wrangler writes log lines to the same output first, so piping it straight into jq fails.

Strip everything before the first line that starts with {:

output="$(npx wrangler preview --name "$PREVIEW_NAME" --json)"
printf '%s\n' "$output" | sed -n '/^{/,$p' | jq -er '.preview.urls[0]'
Keyboard shortcuts
/Open search / command palette
⌘KToggle command palette
gtGo to TIL stream
gbGo to Articles
ghGo to Home
↑↓Navigate results
↵Select result
escClose palette