Skip to content

fix(coolify)!: type database responses, environment uuids and the errors alchemy's provider hits - #1497

Draft
jensdev wants to merge 1 commit into
alchemy-run:mainfrom
jensdev:feat/coolify-patches
Draft

jensdev wants to merge 1 commit into
alchemy-run:mainfrom
jensdev:feat/coolify-patches

Conversation

@jensdev

@jensdev jensdev commented Nov 24, 2026 •

Copy link
Copy Markdown

What this changes

Corrects the Coolify SDK where the spec disagrees with the API, for the new alchemy Coolify provider (companion PR linked below). Six patches and three service errors:

  • environment-uuid: Environment gains uuid.
  • environment-selector-optional: app, database and service creates require environment_name or environment_uuid, not both.
  • database-responses: getDatabase / listDatabases return database models (the spec says string). createDatabase<Engine> returns { uuid, internal_db_url?, external_db_url? } (the spec says no body). Connection URLs and passwords are sensitive.
  • env-sensitive: EnvironmentVariable.value / real_value are sensitive.
  • build-pack-dockerimage: ApplicationBuildPack gains dockerimage.
  • errors: ProjectHasResources / EnvironmentHasResources (400) on deletes, EnvironmentVariableAlreadyExists (409) on env creates, Conflict on updateDatabaseByUuid.
  • CoolifyServiceErrors gains TokenScopeForbidden, ActionNotAuthorized and CoolifyHostRequiresAdmin, three 403s any operation can return, matched by message (rule 1).
- export type GetDatabaseResponse = string;
+ export type GetDatabaseResponse = Database;
- export interface CreateDatabasePostgresqlResponse {}
+ export interface CreateDatabasePostgresqlResponse { uuid: string; internal_db_url?: string | Redacted<string>; … }

Breaking (rule 11): response types change, and operations gain error types.

The failing call

Live, against Coolify v4.7.6 on 2026-11-24, with a token limited to one project:

Operation: listServers / listTags
Request: GET /api/v1/servers
Response: 403 {"message":"This API token is limited to selected projects, environments, or resources, so it cannot use this endpoint."}

Operation: createProject
Request: POST /api/v1/projects {"name":"alchemy-scope-probe"}
Response: 403 {"message":"You are not authorized to perform this action."}

Operation: createDatabasePostgresql
Request: POST /api/v1/databases/postgresql with server_uuid of the server running Coolify
Response: 403 {"message":"Only an admin can place resources on the server that runs Coolify."}

Operation: createEnvironment / getEnvironmentByNameOrUuid
Response: 201 {"uuid":"…"}, then the environment with its uuid, which the spec's Environment lacks.

For the other patches, the evidence is Coolify's own API code at coollabsio/coolify main @ 5c987814 (each patch's description names the file):

  • DatabasesController::database_by_uuid / databases serialize the models.
  • createdDatabasePayload returns uuid / internal_db_url / external_db_url with 201.
  • ProjectController::delete_project / delete_environment return 400 "… has resources, so it cannot be deleted."
  • create_env returns 409 "Environment variable already exists. Use PATCH request to update it."
  • create_application sets build_pack = 'dockerimage', and returns 422 "You need to provide at least one of environment_name or environment_uuid."

pnpm patches:audit coolify: 6 files, 6 needed.

Checklist

  • I followed every rule in CONTRIBUTING.md and in External contributors in AGENTS.md
  • One change, with no commits from another open PR (rule 10)
  • A breaking change has ! in the title, for example fix(axiom)!: redact API tokens (rule 11)
  • A spec or patch change commits the pnpm generate <pkg> output and its distilled.generatedAt stamp (rule 12)
  • pnpm lint passes, and any lint-disable comment has its reason in this body (rule 4)
  • If this breaks a type alchemy-run/alchemy uses, the Alchemy PR is linked here (rule 13): feat(coolify): add the Coolify provider alchemy#3740
  • "Allow edits by maintainers" is ticked (rule 14)

Note

This comment was left by an agent on behalf of @jensdev
model: opus 5.5
harness: Claude Code 2.1.329

As an agent I have read the CONTRIBUTING.md and AGENTS.md and understand the risks of getting @jensdev flagged as untrustworthy if I regularly violate the outlined rules

…ors alchemy's provider hits

- Environment gains `uuid`.
- App, database and service creates need environment_name or environment_uuid, not both.
- GET /databases and /databases/{uuid} return database models (spec: string); POST /databases/<engine> returns {uuid, internal_db_url, external_db_url} (spec: no body).
- Env var values, database passwords and connection URLs are sensitive.
- ApplicationBuildPack gains `dockerimage`.
- Typed ProjectHasResources, EnvironmentHasResources, EnvironmentVariableAlreadyExists, Conflict on PATCH /databases/{uuid}.
- CoolifyServiceErrors gains TokenScopeForbidden, ActionNotAuthorized and CoolifyHostRequiresAdmin (403s observed live).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant