mirror of
https://github.com/certimate-go/certimate.git
synced 2026-04-26 05:05:56 +03:00
[GH-ISSUE #544] 部署到白山云时继续返回 400209 错误 #351
Labels
No labels
announcement
backlog
bug
declined
documentation
duplicate
enhancement
good first issue
good first issue
help wanted
invalid
pull-request
question
stale
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/certimate#351
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Anbool on GitHub (Mar 22, 2025).
Original GitHub issue: https://github.com/certimate-go/certimate/issues/544
版本号:0.3.5
问题:我注意到似乎已经是数组了,但不知道为什么仍然返回了错误。
日志:
[2025-03-22 14:07:20] ready to deploy ...
[2025-03-22 14:07:21] sdk request 'baishan.GetDomainConfig'
request:
{"domains":"google.com","config":["https"]}
response:
null
[2025-03-22 14:07:21] failed to deploy
[2025-03-22 14:07:21] failed to execute sdk request 'baishan.GetDomainConfig': baishan api error: unexpected status code: 400, {"code":400209,"message":"parameter config must be an array."}
我尝试对接口进行手动构建请求,可以按照预期返回。
示例:
curl 'https://cdn.api.baishan.com/v2/domain/config?token=token&domains=google.com&config[]=https'
响应体:
{
"code": 0,
"data": [
{
"domain": "google.com",
"domain_id": "106001",
"status": "serving",
"type": "dynamic",
"config": {
"https": {
"cert_id": 120610,
"http2": "on",
"force_https": "302",
"ocsp": "on"
}
}
}
]
}
@fudiwei commented on GitHub (Mar 22, 2025):
config 传多个值的时候 URL 是啥样的?
@fudiwei commented on GitHub (Mar 22, 2025):
@Anbool 看起来白山云用了某种非标的 URL 传参方式,试着改了改。但我没有白山云账号,你可以帮我拉一下 commit 代码后用你的 Token 跑一下单测用例吗?
commit:
516a958c66终端进入到项目的
internal/pkg/core/deployer/providers/baishan-cdn/目录下,执行:@Anbool commented on GitHub (Mar 22, 2025):
可以的,这两天测试后给你反馈
@Anbool commented on GitHub (Mar 24, 2025):
我已经进行了测试并失败,以下是测试日志。不过值得一提的是,白山云 API 的接口传递数组参数确实是非标的:https://cdn.api.baishan.com/v2/domain/config?token=token&domains=www.test.com&config[]=referer&config[]=origin
代表查询 www.test.com 域名下的 referer 和 origin 配置。
root@Small-Build:/data/certimate# git status
HEAD detached at
516a958cnothing to commit, working tree clean
root@Small-Build:/data/certimate# cd internal/pkg/core/deployer/providers/baishan-cdn/
root@Small-Build:/data/certimate/internal/pkg/core/deployer/providers/baishan-cdn# ls
baishan_cdn.go baishan_cdn_test.go
root@Small-Build:/data/certimate/internal/pkg/core/deployer/providers/baishan-cdn# go test -v ./baishan_cdn_test.go -args --CERTIMATE_DEPLOYER_BAISHANCDN_INPUTCERTPATH="/root/cert.pem" --CERTIMATE_DEPLOYER_BAISHANCDN_INPUTKEYPATH="/root/key.pem" --CERTIMATE_DEPLOYER_BAISHANCDN_APITOKEN="这是一个Token" --CERTIMATE_DEPLOYER_BAISHANCDN_DOMAIN="这是一个域名"
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/go-resty/resty/v2 v2.16.5
go: downloading golang.org/x/net v0.37.0
=== RUN TestDeploy
=== RUN TestDeploy/Deploy
baishan_cdn_test.go:43: args:
INPUTCERTPATH: /root/cert.pem
INPUTKEYPATH: /root/key.pem
APITOKEN: 这是一个Token
DOMAIN: 这是一个域名
2025/03/24 02:46:59.513279 DEBUG RESTY
@fudiwei commented on GitHub (Mar 24, 2025):
@Anbool 麻烦在现在的基础上再拉一下 commit
892256c0b9,重新跑一下单测看看。@Anbool commented on GitHub (Mar 24, 2025):
@fudiwei 看上去
github.com/usual2970/certimate@892256c0b9测试已通过。root@Small-Build:/data/certimate/internal/pkg/core/deployer/providers/baishan-cdn# go test -v ./baishan_cdn_test.go -args --CERTIMATE_DEPLOYER_BAISHANCDN_INPUTCERTPATH="/root/cert.pem" --CERTIMATE_DEPLOYER_BAISHANCDN_INPUTKEYPATH="/root/key.pem" --CERTIMATE_DEPLOYER_BAISHANCDN_APITOKEN="这是一个Token" --CERTIMATE_DEPLOYER_BAISHANCDN_DOMAIN="这是一个域名"
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/go-resty/resty/v2 v2.16.5
go: downloading golang.org/x/net v0.37.0
=== RUN TestDeploy
=== RUN TestDeploy/Deploy
baishan_cdn_test.go:43: args:
INPUTCERTPATH: /root/cert.pem
INPUTKEYPATH: /root/key.pem
APITOKEN: 这是一个Token
DOMAIN: 这是一个域名
baishan_cdn_test.go:64: err: baishan api error: unexpected status code: 400, {"code":400699,"message":"this certificate is exists, cert_id is (这是一个证书ID)"}
failed to execute sdk request 'baishan.CreateCertificate'
github.com/usual2970/certimate/internal/pkg/core/deployer/providers/baishan-cdn.(*DeployerProvider).Deploy
/data/certimate/internal/pkg/core/deployer/providers/baishan-cdn/baishan_cdn.go:86
command-line-arguments_test.TestDeploy.func1
/data/certimate/internal/pkg/core/deployer/providers/baishan-cdn/baishan_cdn_test.go:62
testing.tRunner
/usr/local/go/src/testing/testing.go:1792
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1700
--- FAIL: TestDeploy (1.25s)
--- FAIL: TestDeploy/Deploy (1.25s)
FAIL
FAIL command-line-arguments 1.255s
FAIL