Skip to content

fix(cli): add hardcoded fallback for service required parameters#8

Merged
dviejokfs merged 1 commit intomainfrom
fix/cli-service-params-fallback
Feb 17, 2026
Merged

fix(cli): add hardcoded fallback for service required parameters#8
dviejokfs merged 1 commit intomainfrom
fix/cli-service-params-fallback

Conversation

@dviejokfs
Copy link
Copy Markdown
Contributor

Summary

  • Fixed service creation still failing after PR fix(cli): populate required parameters when creating services in wizard #7 because the schema API call (GET /external-services/types/{type}/parameters) returns { error } without throwing, causing requiredFields to stay empty
  • Added KNOWN_REQUIRED_FIELDS hardcoded fallback map so PostgreSQL and MongoDB always get database and username populated regardless of whether the schema fetch succeeds

Root cause

The @hey-api client doesn't throw on HTTP errors — it returns { data: undefined, error: ... }. The previous try/catch only caught network-level exceptions, not API-level errors. When the schema call returned an error response, requiredFields stayed [] and no parameters were generated.

Fix

Two-layer approach:

  1. Check error from the API response (not just rely on try/catch)
  2. Hardcoded fallback: if schema fetch returns nothing, use KNOWN_REQUIRED_FIELDS[serviceType] which maps postgres['database', 'username'] and mongodb['database', 'username']

This ensures service creation works even if the schema endpoint is unreachable, returns an error, or changes format.

The schema API call (GET /external-services/types/{type}/parameters) can
fail silently (returns { error } without throwing), leaving requiredFields
empty and causing service creation to still send parameters: {}.

Added KNOWN_REQUIRED_FIELDS fallback map so postgres and mongodb always
get database/username populated even when the schema fetch fails.
@dviejokfs dviejokfs merged commit b826018 into main Feb 17, 2026
4 of 5 checks passed
@dviejokfs dviejokfs deleted the fix/cli-service-params-fallback branch February 25, 2026 16:46
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