cloudflare-go
cloudflare-go copied to clipboard
v4: Client.Pages.Projects.Deployments.New() Returns 400 Bad Request with Valid Payload
trafficstars
Confirm this is a Go library issue and not an underlying Cloudflare API issue
- [x] This is an issue with the Go library
Describe the bug
Calling Client.Pages.Projects.Deployments.New with a properly constructed ProjectDeploymentNewParams results in the following error:
400 Bad Request {
"result": null,
"success": false,
"errors": [
{
"code": 8000096,
"message": "A \"manifest\" field was expected in the request body but was not provided."
}
],
"messages": []
}
Based on this API conventions, it seems that both the manifest field and the uploaded assets file are required.
To Reproduce
1 - Create a Cloudflare client 2 - Create a Cloudflare page by Client.Pages.Projects.New(...) 3 - Try to deploy it by Client.Pages.Projects.Deployments.New(...) with pages.ProjectDeploymentNewParams{...} as param
Code snippets
func deployPanel(ctx context.Context) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
select {
case <-ctx.Done():
return
case token := <-oauthTokenChan:
cfClient = cf.NewClient(option.WithAPIToken(token.AccessToken))
...
}
...
for {
fmt.Printf("\n%s Deploying Page...\n", title)
_, err := deployPage(ctx, project)
if err != nil {
failMessage("Error deploying page", err)
if response := promptUser("Would you like to try again? (y/n): "); strings.ToLower(response) == "n" {
return
}
continue
}
successMessage("Page deployed successfully!")
break
}
}
func deployPage(ctx context.Context, project *pages.Project) (*pages.Deployment, error) {
return cfClient.Pages.Projects.Deployments.New(
ctx,
project.Name,
pages.ProjectDeploymentNewParams{AccountID: cf.F(cfAccount.ID)},
)
}
OS
macOS
Go version
1.24.1
Library version
github.com/cloudflare/cloudflare-go/[email protected]