N
Neon11mo ago
stormy-gold

HTTP 423 while generating endpoint for branch that was just created.

Hello! I am using the API to generate branches in one of my applications. I first create the branch and then create an endpoint to be able to get a connection URL. My call to generate the endpoint is failing with a 423:
const branch = await neonApiClient.createProjectBranch(projectId);
console.log('Branch created:', branch.data.branch.id);
console.log('Creating endpoint:');
//Folowing line fails with 423 on first call
const epr = await neonApiClient.createProjectEndpoint(projectId, {
endpoint: {
branch_id: branch.data.branch.id,
type: EndpointType.ReadWrite,
},
});
const branch = await neonApiClient.createProjectBranch(projectId);
console.log('Branch created:', branch.data.branch.id);
console.log('Creating endpoint:');
//Folowing line fails with 423 on first call
const epr = await neonApiClient.createProjectEndpoint(projectId, {
endpoint: {
branch_id: branch.data.branch.id,
type: EndpointType.ReadWrite,
},
});
however, a few minutes later further calls succeed without a problem. I suppose this is because the branch is being created and I cannot request a breakpoint creation while that is going on....
3 Replies
stormy-gold
stormy-goldOP11mo ago
COnfirmed. The problem went away by creating the endpoint at the same time as the branch:
const branch = await neonApiClient.createProjectBranch(projectId, {
endpoints: [
{
type: EndpointType.ReadWrite,
},
],
});
const branch = await neonApiClient.createProjectBranch(projectId, {
endpoints: [
{
type: EndpointType.ReadWrite,
},
],
});
genetic-orange
genetic-orange11mo ago
Glad to hear that you made it work 😄
stormy-gold
stormy-goldOP11mo ago
Thanks!

Did you find this page helpful?