Skip to main content
Version: Next

Validate Your Flow Configurations

The Validate Your Flow Configurations feature in Lunar.dev allows users to verify their flow settings before deploying them into production. This validation step is crucial for catching any configuration errors, such as missing parameters, improper connections, or unsupported fields, ensuring that your flows will run smoothly when live.

Using the validate_flows Command​

When you're ready to validate your flows, simply run the following command in your Kubernetes or Docker environment:

kubectl exec <lunar-proxy-pod-name> -- validate_flows

For Docker:

docker exec lunar-proxy validate_flows

This command checks each flow configuration file and performs a "dry run" by loading the flows without enforcing them in live traffic. It will log any configuration issues and confirm when the flows pass validation. Here’s how it works and what you can expect.

What the Validation Does​

  • Loads and Parses Configurations: Reads all YAML files in your specified flow, quota, and path directories.
  • Checks Syntax and Structure: Ensures that YAML syntax is correct, with no missing or invalid keys.
  • Validates Connections and Parameters: Confirms that all required parameters, such as filters and processors, are defined.
  • Reports Errors or Success: Provides feedback for any detected issues or, if all is well, confirms that flows are validated successfully.

Example Use Cases and Responses​

Example 1: Missing Required Fields

If a flow configuration file lacks a required field, the validate_flows command will return an error message like this:

πŸ’” Failed to validate flows: connection from is required in file path: /flows/my_flow.yaml
This message helps you locate the file and missing field, allowing you to add the required field and re-run validation.
Example 2: Invalid YAML Syntax

In cases where the YAML syntax is incorrect (e.g., indentation issues or missing colons), you might see:

πŸ’” Failed to validate flows: YAML syntax error in file /flows/rate_limit.yaml at line 10: unexpected indentation

After fixing the YAML syntax, re-run the validation command.

Example 3: Unsupported Parameters in Flow

If your flow configuration includes unsupported parameters or incorrect types, the validation will fail with an error message like:

πŸ’” Failed to validate flows: unsupported parameter "rate_limit_type" found in /flows/rate_limit.yaml

This error indicates that rate_limit_type is not recognized. Adjust the parameter according to the Lunar.dev documentation, and re-run validation.

Example 4: Successful Validation

When all configurations pass validation, you’ll see a success message:

βœ… Successfully validated flows

This confirmation means your configurations are ready for deployment, and you can confidently load them into production.

Key Benefits of Running validate_flows​

  • Avoid Production Issues: Catch and resolve configuration errors before they affect live traffic.
  • Troubleshoot Quickly: Receive detailed feedback on configuration issues, saving time in debugging.
  • Ensure Compliance: Confirm that flows adhere to Lunar.dev’s structure, avoiding unsupported setups or risky configurations.

By using validate_flows before each deployment, you maintain robust, error-free flow configurations, reducing the risk of production disruptions. This essential validation step provides confidence and reliability, ensuring that your API consumption management operates seamlessly.