Error using API Create PagesProject with pulumi - Err 'You must set a production branch.'
Calling this from a monorepo. I want to use pulumi to create a pages project/update it
import { PagesProject, type PagesProjectArgs } from '@pulumi/cloudflare'
const projectName = 'spa-cf'
const CLOUDFLARE_ACCOUNT_ID = process.env.CLOUDFLARE_ACCOUNT_ID
const CLOUDFLARE_API_TOKEN = process.env.CLOUDFLARE_API_TOKEN
const pagesProjectConfig: PagesProjectArgs = {
accountId: CLOUDFLARE_ACCOUNT_ID,
name: projectName,
productionBranch: 'main',
buildConfig: {
buildCaching: true,
buildCommand: 'bun run build',
destinationDir: '../apps/spa/dist',
rootDir: '../apps/spa',
},
}
export const pagesProject = new PagesProject(projectName, pagesProjectConfig)
š ~ file: pages.ts:58 ~ createProject ~ url: https://api.cloudflare.com/client/v4/accounts/xxxx/pages/projects
š ~ file: pages.ts:58 ~ createProject ~ request: {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer XXX'
},
body: '{"accountId":"XXXX","name":"spa-cf","productionBranch":"main","buildConfig":{"buildCaching":true,"buildCommand":"bun run build","destinationDir":"../apps/spa/dist","rootDir":"../apps/spa"}}'
import { PagesProject, type PagesProjectArgs } from '@pulumi/cloudflare'
const projectName = 'spa-cf'
const CLOUDFLARE_ACCOUNT_ID = process.env.CLOUDFLARE_ACCOUNT_ID
const CLOUDFLARE_API_TOKEN = process.env.CLOUDFLARE_API_TOKEN
const pagesProjectConfig: PagesProjectArgs = {
accountId: CLOUDFLARE_ACCOUNT_ID,
name: projectName,
productionBranch: 'main',
buildConfig: {
buildCaching: true,
buildCommand: 'bun run build',
destinationDir: '../apps/spa/dist',
rootDir: '../apps/spa',
},
}
export const pagesProject = new PagesProject(projectName, pagesProjectConfig)
š ~ file: pages.ts:58 ~ createProject ~ url: https://api.cloudflare.com/client/v4/accounts/xxxx/pages/projects
š ~ file: pages.ts:58 ~ createProject ~ request: {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer XXX'
},
body: '{"accountId":"XXXX","name":"spa-cf","productionBranch":"main","buildConfig":{"buildCaching":true,"buildCommand":"bun run build","destinationDir":"../apps/spa/dist","rootDir":"../apps/spa"}}'
Initial deployment triggered: {
result: null,
success: false,
errors: [ { code: 8000033, message: 'You must set a production branch.' } ],
messages: []
}
Initial deployment triggered: {
result: null,
success: false,
errors: [ { code: 8000033, message: 'You must set a production branch.' } ],
messages: []
}
1 Reply
That body JSON isn't correct
I'd chat to whoever maintains the Pulumi integration. It isn't owned by us
All keys should be snake_case not pascalCase