[PR #8] [MERGED] fix(cli): add hardcoded fallback for service required parameters #12

Closed
opened 2026-03-02 05:12:31 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/gotempsh/temps/pull/8
Author: @dviejokfs
Created: 2/17/2026
Status: Merged
Merged: 2/17/2026
Merged by: @dviejokfs

Base: mainHead: fix/cli-service-params-fallback


📝 Commits (1)

  • faa31ff fix(cli): add hardcoded fallback for service required parameters

📊 Changes

1 file changed (+25 additions, -7 deletions)

View changed files

📝 apps/temps-cli/src/lib/service-setup.ts (+25 -7)

📄 Description

Summary

  • Fixed service creation still failing after PR #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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/gotempsh/temps/pull/8 **Author:** [@dviejokfs](https://github.com/dviejokfs) **Created:** 2/17/2026 **Status:** ✅ Merged **Merged:** 2/17/2026 **Merged by:** [@dviejokfs](https://github.com/dviejokfs) **Base:** `main` ← **Head:** `fix/cli-service-params-fallback` --- ### 📝 Commits (1) - [`faa31ff`](https://github.com/gotempsh/temps/commit/faa31ffb438b15edd37d5d14ea8e5b046108e2db) fix(cli): add hardcoded fallback for service required parameters ### 📊 Changes **1 file changed** (+25 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `apps/temps-cli/src/lib/service-setup.ts` (+25 -7) </details> ### 📄 Description ## Summary - **Fixed** service creation still failing after PR #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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 05:12:31 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/temps#12
No description provided.