Skip to content

mw stack deploy should show API response in the debug output #1399

@CSchulz

Description

@CSchulz

mw stack deploy should show the original API error during the run and not after hitting the timeout.

To Reproduce
Steps to reproduce the behavior:

  1. Use the docker-compose.yml file and try to deploy. DEBUG=* mw stack deploy
docker-compose.yml
services:
  postgresql:
    image: docker.io/library/postgres:16-alpine
    env_file: .env
    environment:
      POSTGRES_DB: ${PG_DB:-authentik}
      POSTGRES_USER: ${PG_USER:-authentik}
      POSTGRES_PASSWORD: ${PG_PASS:?database password required}
    volumes:
      - database:/var/lib/postgresql/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
      interval: 30s
      retries: 5
      start_period: 20s
      timeout: 5s

  redis:
    image: redis:alpine
    command: --save 60 1 --loglevel warning
    volumes:
      - redis:/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
      interval: 30s
      retries: 5
      start_period: 20s
      timeout: 3s

  server:
    image: ghcr.io/goauthentik/server:2025.8.3
    command: server
    env_file: .env
    environment:
      AUTHENTIK_POSTGRESQL__HOST: postgresql
      AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
      AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
      AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
      AUTHENTIK_REDIS__HOST: redis
      AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY:?secret key required}
    ports:
      - ${COMPOSE_PORT_HTTP:-9000}:9000
      - ${COMPOSE_PORT_HTTPS:-9443}:9443
    volumes:
      - ./media:/media
      - ./custom-templates:/templates
    restart: unless-stopped
    depends_on:
      postgresql:
        condition: service_healthy
      redis:
        condition: service_healthy

  worker:
    image: ghcr.io/goauthentik/server:2025.8.3
    command: worker
    env_file: .env
    environment:
      AUTHENTIK_POSTGRESQL__HOST: postgresql
      AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
      AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
      AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
      AUTHENTIK_REDIS__HOST: redis
      AUTHENTIK_SECRET_KEY: ${AUTHENTIK_SECRET_KEY:?secret key required}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./media:/media
      - ./certs:/certs
      - ./custom-templates:/templates
    restart: unless-stopped
    depends_on:
      postgresql:
        condition: service_healthy
      redis:
        condition: service_healthy
    user: root

volumes:
  database:
    driver: local
  redis:
    driver: local
  1. Wait ...
  2. See error

Expected behavior
It should print the error already during the run.

Console logs
If applicable, add console outputs to help explain your problem.

Full output with DEBUG=*
  mw:api-retry retrying request after 10 attempts; error: 'Request failed with status code 412' +53s
  mw:api:client:request PUT v2/stacks/808b1808-82dc-4d12-b560-3fbf43801f07 requested with '{"services":{"postgresql":{"image":"docker.io/library/postgres:16-alpine","volumes":["database:/var/lib/postgresql/data"],"restart":"unless-stopped","healthcheck":{"test":["CMD-SHELL","pg_isready -d $ -U $"],"interval":"30s","retries":5,"start_period":"20s","timeout":"5s"},"description":"postgresql","envs":{"PG_PASS":"M0tGYDSqTathL17Iz7ZzE10p0JeyaKTThkofEUl/VTDHgJOc","AUTHENTIK_SECRET_KEY":"YADgEcEfTvW0s9xOrRWLIZFxTXjYKg/pcfiZGo396UHEM11/KHVk7up0cmHvFbTViPqrwoftpqnNCV3B","AUTHENTIK_ERROR_REPORTING__ENABLED":"true","POSTGRES_DB":"authentik","POSTGRES_USER":"authentik","POSTGRES_PASSWORD":"${PG_PASS:?database password required}"}},"redis":{"image":"redis:alpine","command":["--save 60 1 --loglevel warning"],"volumes":["redis:/data"],"restart":"unless-stopped","healthcheck":{"test":["CMD-SHELL","redis-cli ping | grep PONG"],"interval":"30s","retries":5,"start_period":"20s","timeout":"3s"},"description":"redis","envs":{}},"server":{"image":"ghcr.io/goauthentik/server:2025.8.3","command":["server"],"ports":["9000:9000","9443:9443"],"volumes":["./media:/media","./custom-templates:/templates"],"restart":"unless-stopped","depends_on":{"postgresql":{"condition":"service_healthy"},"redis":{"condition":"service_healthy"}},"description":"server","envs":{"PG_PASS":"M0tGYDSqTathL17Iz7ZzE10p0JeyaKTThkofEUl/VTDHgJOc","AUTHENTIK_SECRET_KEY":"${AUTHENTIK_SECRET_KEY:?secret key required}","AUTHENTIK_ERROR_REPORTING__ENABLED":"true","AUTHENTIK_POSTGRESQL__HOST":"postgresql","AUTHENTIK_POSTGRESQL__NAME":"authentik","AUTHENTIK_POSTGRESQL__USER":"authentik","AUTHENTIK_POSTGRESQL__PASSWORD":"M0tGYDSqTathL17Iz7ZzE10p0JeyaKTThkofEUl/VTDHgJOc","AUTHENTIK_REDIS__HOST":"redis"}},"worker":{"image":"ghcr.io/goauthentik/server:2025.8.3","command":["worker"],"volumes":["/var/run/docker.sock:/var/run/docker.sock","./media:/media","./certs:/certs","./custom-templates:/templates"],"restart":"unless-stopped","depends_on":{"postgresql":{"condition":"service_healthy"},"redis":{"condition":"service_healthy"}},"user":"root","description":"worker","envs":{"PG_PASS":"M0tGYDSqTathL17Iz7ZzE10p0JeyaKTThkofEUl/VTDHgJOc","AUTHENTIK_SECRET_KEY":"${AUTHENTIK_SECRET_KEY:?secret key required}","AUTHENTIK_ERROR_REPORTING__ENABLED":"true","AUTHENTIK_POSTGRESQL__HOST":"postgresql","AUTHENTIK_POSTGRESQL__NAME":"authentik","AUTHENTIK_POSTGRESQL__USER":"authentik","AUTHENTIK_POSTGRESQL__PASSWORD":"M0tGYDSqTathL17Iz7ZzE10p0JeyaKTThkofEUl/VTDHgJOc","AUTHENTIK_REDIS__HOST":"redis"}}},"volumes":{"database":{"driver":"local"},"redis":{"driver":"local"}}}' +2m
  follow-redirects options {
  maxRedirects: 21,
  maxBodyLength: Infinity,
  protocol: 'https:',
  path: '/v2/stacks/808b1808-82dc-4d12-b560-3fbf43801f07',
  method: 'PUT',
  headers: [Object: null prototype] {
    Accept: 'application/json, text/plain, */*',
    'Content-Type': 'application/json',
    'User-Agent': 'mittwald-cli/1.11.1',
    'x-access-token': '1e1f64b8-bb78-4869-ae5c-2a12f1e7b433:PZ41g-0kASbxkDtwVaBdN_l0xisKTuE70sB-Klr2eaQ:mittwald_a',
    'Content-Length': '2536',
    'Accept-Encoding': 'gzip, compress, deflate, br'
  },
  agents: { http: undefined, https: undefined },
  auth: undefined,
  family: undefined,
  beforeRedirect: [Function: dispatchBeforeRedirect],
  beforeRedirects: { proxy: [Function: beforeRedirect] },
  hostname: 'api.mittwald.de',
  port: '',
  agent: undefined,
  nativeProtocols: {
    'http:': {
      _connectionListener: [Function: connectionListener],
      METHODS: [Array],
      STATUS_CODES: [Object],
      Agent: [Function],
      ClientRequest: [Function: ClientRequest],
      IncomingMessage: [Function: IncomingMessage],
      OutgoingMessage: [Function: OutgoingMessage],
      Server: [Function: Server],
      ServerResponse: [Function: ServerResponse],
      createServer: [Function: createServer],
      validateHeaderName: [Function],
      validateHeaderValue: [Function],
      get: [Function: get],
      request: [Function: request],
      setMaxIdleHTTPParsers: [Function: setMaxIdleHTTPParsers],
      maxHeaderSize: [Getter],
      globalAgent: [Getter/Setter]
    },
    'https:': {
      Agent: [Function: Agent],
      globalAgent: [Agent],
      Server: [Function: Server],
      createServer: [Function: createServer],
      get: [Function: get],
      request: [Function: request]
    }
  }
  ❌deploying stack. error

     An error occurred during this operation:
     ApiClientError: Unexpected response status (expected 200, got: 412)

  oclif:config start finally hook +4m
  oclif:config finally hook done +0ms
┌──────────────────────────────────────────────────────────────────────────────┐
│  API CLIENT ERROR                                                            │
│                                                                              │
│  An error occurred while communicating with the API: Unexpected response     │
│  status (expected 200, got: 412)                                             │
│                                                                              │
│  Request      PUT v2/stacks/808b1808-82dc-4d12-b560-3fbf43801f07             │
│  Response     412 Precondition Failed                                        │
│  Error Type   VError                                                         │
│  Message      failed to mount volume ./media, it doesn't seem to exist       │
│  Trace ID     a463f93e883a549e                                               │
│                                                                              │
│  {                                                                           │
│    "params": {                                                               │
│      "traceId": "a463f93e883a549e"                                           │
│    },                                                                        │
│    "message": "failed to mount volume ./media, it doesn't seem to exist",    │
│    "type": "VError"                                                          │
│  }                                                                           │
└──────────────────────────────────────────────────────────────────────────────┘

  ERROR STACK TRACE

  Please provide this when opening a bug report.

  ApiClientError: Unexpected response status (expected 200, got: 412)
      at ApiClientError.fromResponse (file:///usr/local/Cellar/mw/1.11.1/libexec/node_modules/@mittwald/api-client-commons/dist/esm/core/ApiClientError.js:9:16)
      at assertOneOfStatus (file:///usr/local/Cellar/mw/1.11.1/libexec/node_modules/@mittwald/api-client-commons/dist/esm/types/assertOneOfStatus.js:4:30)
      at assertStatus (file:///usr/local/Cellar/mw/1.11.1/libexec/node_modules/@mittwald/api-client-commons/dist/esm/types/assertStatus.js:3:5)
      at file:///usr/local/Cellar/mw/1.11.1/libexec/dist/commands/stack/deploy.js:45:13
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async FancyProcessRenderer.runStep (file:///usr/local/Cellar/mw/1.11.1/libexec/dist/rendering/process/process_fancy.js:44:28)
      at async Deploy.exec (file:///usr/local/Cellar/mw/1.11.1/libexec/dist/commands/stack/deploy.js:40:31)
      at async Deploy.run (file:///usr/local/Cellar/mw/1.11.1/libexec/dist/lib/basecommands/ExecRenderBaseCommand.js:21:24)
      at async Deploy._run (/usr/local/Cellar/mw/1.11.1/libexec/node_modules/@oclif/core/lib/command.js:181:22)
      at async Config.runCommand (/usr/local/Cellar/mw/1.11.1/libexec/node_modules/@oclif/core/lib/config/config.js:456:25)

Environment:

  • OS: macOS 15
  • Version: @mittwald/cli/1.11.1 darwin-x64 node-v20.19.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions