首页 > 解决方案 > Cloudflare wrangler tail --format pretty:解析响应正文时出错

问题描述

使用时wrangler tail --format pretty,我收到以下错误:

Error parsing response body!
This is not a problem with your worker, it's a problem with Wrangler.
Please file an issue on our GitHub page, with a minimal reproducible example of
the script that caused this error and a description of what happened.

如错误消息中所述,我很难将 JSON 从wrangler tail --format jsonGithub 问题上传,因为它包含整个请求详细信息,其中包括我的邮政编码、纬度、经度,尽管我不确定为什么会有这么多日志中的个人信息。

标签: cloudflarecloudflare-workers

解决方案


我发现最快的解决方案是使用jq而不是使用wrangler tail --format pretty

在 macOS 上,

  • 安装jq:brew install jq
  • 管道牧马人输出到 jq 中:wrangler tail --env environment_name | jq

推荐阅读