-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
错误提示 #714
Comments
@Khaose-tech 配置管理taskbefore.sh看看有没有内容,有就清空掉 |
感谢大佬的回复,清除task_before.sh里的内容,“jq: error (at :1): Cannot iterate over null (null)”这个问题已经解决了 |
第二个错误终于解决了。 |
@6dylan6 jq: error (at :1): Cannot iterate over null (null) 这个报错我排查定位出现在 task_before.sh( https://github.com/6dylan6/jdpro/blob/main/docker/task_before.sh ) ,建议修改一下其中的 def_envs_tool 函数为如下: def_envs_tool(){
local i
for i in $@; do
# 检查文件是否存在
if [[ ! -f "$file_auth_user" ]]; then
echo "ERROR: auth 文件不存在: $file_auth_user"
return 1
fi
# 获取并验证 token
local token=$(cat $file_auth_user | jq -r .token 2>/dev/null)
if [[ -z "${token}" || "${token}" == "null" ]]; then
echo "ERROR: token 无效"
return 1
fi
# 发送请求并处理响应
local response=$(curl -s --noproxy "*" "http://0.0.0.0:5600/api/envs?searchValue=$i" -H "Authorization: Bearer $token")
if [[ $? -ne 0 ]]; then
echo "ERROR: API 请求失败"
continue
fi
# 安全地解析 JSON
if echo "${response}" | jq -e . >/dev/null 2>&1; then
echo "${response}" | jq '.data // empty'
else
echo "ERROR: 无效的 JSON 响应"
fi
done
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
现在跑脚本会出现两个错误提示
1:jq: error (at :1): Cannot iterate over null (null)
2:Error: Malformed UTF-8 data
第一个不会影响脚本运行
第二个就会直接结束脚本
不知各位大佬有办法解决
The text was updated successfully, but these errors were encountered: