Skip to content

[Bug]: POST /api/v1/services rejects connect_to_docker_network for docker_compose_raw services (422 "field is not allowed") #12014

Description

@niklebe

Description and Error Message

POST /api/v1/services rejects connect_to_docker_network when you create a service from docker_compose_raw. The request fails with:

422 {"message":"Validation failed.","errors":{"connect_to_docker_network":["This field is not allowed."]}}

The field is meant to be accepted on this path. The custom-compose branch of create_service lists it in its own $allowedFields and validates it as boolean (ServicesController.php#L589-L600 @ v4.3.23). But the request never gets that far. The top-level $allowedFields at the start of create_service (L362) does not include connect_to_docker_network, and the extra-fields check at L400 returns the 422 before the code branches on type vs docker_compose_raw.

PATCH /api/v1/services/{uuid} accepts the field (L1178). The only workaround is to create without it and PATCH afterwards. That needs an extra round trip, and the flag only takes effect on the next start, so the service can't be created and deployed in one step with the network attached (see #11295 / #11371 for how the flag is applied post-up).

Steps to Reproduce

  1. POST /api/v1/services with project_uuid, server_uuid, environment_name, a valid docker_compose_raw, and "connect_to_docker_network": true.
  2. Observe the 422 This field is not allowed.
  3. Repeat without the field and then PATCH it to true. That succeeds.

Example Repository URL

N/A (API only). Reproduced through the coolify-terraform/coolify provider 0.1.23, which sends the field on create.

Coolify Version

v4.3.18 (reproduced live). The code path is unchanged in v4.3.23.

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 24.04

Additional Information

Suggested fix: add connect_to_docker_network to the top-level $allowedFields in create_service (the one-click type path already forces it to true, so it's harmless there).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🌐️ APIIssues or PRs that relate to the Coolify API.🐛 Possible BugReported issues that need to be reproduced by the team.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions