wrangler preview --json prints log lines before the JSON
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]'