gitlabEdit

๐Ÿ”ŒConfiguration Problems

Complete guide to debugging Docs-Dispatcher's hybrid 3-tier configuration resolution system.

Overview

This guide covers:

  • Hybrid config resolution (Company โ†’ User โ†’ Explicit)

  • Missing provider configuration

  • Invalid credentials

  • Config validation errors

  • Config inheritance issues

  • Testing config resolution

  • Debug logging for config

  • Common configuration mistakes

Configuration Architecture

3-Tier Resolution System

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Tier 1: COMPANY DEFAULT CONFIG                             โ”‚
โ”‚ - Set by admin at company level                            โ”‚
โ”‚ - Applies to all users in company                          โ”‚
โ”‚ - Lowest priority                                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚ (can be overridden)
                         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Tier 2: USER OVERRIDE CONFIG                               โ”‚
โ”‚ - Set by user for their account                            โ”‚
โ”‚ - Overrides company default                                โ”‚
โ”‚ - Medium priority                                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚ (can be overridden)
                         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Tier 3: EXPLICIT providerName IN REQUEST                   โ”‚
โ”‚ - Specified in API request body                            โ”‚
โ”‚ - Overrides all other configs                              โ”‚
โ”‚ - Highest priority (ALWAYS WINS)                           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Resolution Order

When Dispatcher receives a request:

  1. Check for explicit providerName in request โ†’ Use if present

  2. Check for user override config โ†’ Use if exists

  3. Check for company default config โ†’ Use if exists

  4. No config found โ†’ Return 400 error

Common Configuration Issues

Issue 1: "Provider not configured"

Error:

Causes:

  • Provider not configured at any level

  • Configuration exists but is inactive

  • Wrong service/provider combination

  • User/company mismatch

Solution 1: Check All Configuration Levels

Solution 2: Create Missing Configuration

Issue 2: Configuration Priority Confusion

Scenario:

Understanding Priority

Output:

Issue 3: Invalid Credentials

Error:

Solution: Validate Credentials

Issue 4: Config Validation Errors

Error:

Solution: Validate Config Schema

Issue 5: Config Inheritance Issues

Scenario: User expects company default but user override is active.

Testing Configuration Resolution

Test Resolution Logic

Simulate Dispatch

Debug Logging

Enable Config Debug Mode

Common Configuration Mistakes

Mistake 1: Inactive Configuration

Mistake 2: Multiple Defaults

Mistake 3: Wrong Service Type

Best Practices

1. Use Company Defaults

2. User Overrides for Exceptions

3. Explicit Provider for Edge Cases

4. Validate Before Saving

Summary

Key configuration concepts:

  1. 3-tier resolution: Company โ†’ User โ†’ Explicit (highest priority)

  2. Explicit always wins: providerName in request overrides all

  3. Check all levels: User override may hide company default

  4. Validate credentials: Test API keys before saving

  5. Use company defaults: Set defaults for all users

  6. User overrides sparingly: Only for special cases

  7. Debug systematically: Check user โ†’ company โ†’ explicit

  8. Keep configs active: Inactive configs won't be used

Quick debugging:

  1. Check if provider configured: GET /api/v1/users/me/configs

  2. Check company config: GET /api/v1/companies/me/configs

  3. Verify credentials: Test provider API directly

  4. Test resolution: Use simulation tool

  5. Check active status: Ensure isActive: true

Configuration is key to successful dispatching. When in doubt, use explicit providerName in requests to bypass resolution complexity.

Last updated