Skip to content

Commit 95b4611

Browse files
chrjones-rhclaude
andcommitted
fix(automl,autorag): log port-forward errors instead of silently dropping
Address review feedback: ForwardURL errors in the S3 handler and LlamaStack middleware were silently swallowed. Now log warnings consistent with the pattern used in AttachPipelineServerClient. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent acf5a82 commit 95b4611

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

packages/automl/bff/internal/api/s3_handler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ func (app *App) resolveS3Client(w http.ResponseWriter, r *http.Request, secretNa
149149
// Dev-only: rewrite S3 endpoint to localhost via dynamic port-forward.
150150
// portForwardManager is nil in production (requires DevMode=true).
151151
if app.portForwardManager != nil && creds.EndpointURL != "" {
152-
if rewritten, pfErr := app.portForwardManager.ForwardURL(ctx, creds.EndpointURL); pfErr == nil {
152+
if rewritten, pfErr := app.portForwardManager.ForwardURL(ctx, creds.EndpointURL); pfErr != nil {
153+
app.logger.Warn("dynamic port-forward failed for S3 endpoint, using original URL",
154+
"error", pfErr, "url", creds.EndpointURL)
155+
} else {
153156
creds.EndpointURL = rewritten
154157
}
155158
}

packages/autorag/bff/internal/api/middleware.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,10 @@ func (app *App) AttachLlamaStackClientFromSecret(next func(http.ResponseWriter,
387387
// Dev-only: rewrite LlamaStack URL to localhost via dynamic port-forward.
388388
// portForwardManager is nil in production (requires DevMode=true).
389389
if app.portForwardManager != nil {
390-
if rewritten, pfErr := app.portForwardManager.ForwardURL(ctx, baseURL); pfErr == nil {
390+
if rewritten, pfErr := app.portForwardManager.ForwardURL(ctx, baseURL); pfErr != nil {
391+
logger.Warn("dynamic port-forward failed for LlamaStack endpoint, using original URL",
392+
"error", pfErr, "url", baseURL)
393+
} else {
391394
baseURL = rewritten
392395
}
393396
}

packages/autorag/bff/internal/api/s3_handler.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ func (app *App) resolveS3Client(w http.ResponseWriter, r *http.Request, secretNa
147147
// Dev-only: rewrite S3 endpoint to localhost via dynamic port-forward.
148148
// portForwardManager is nil in production (requires DevMode=true).
149149
if app.portForwardManager != nil && creds.EndpointURL != "" {
150-
if rewritten, pfErr := app.portForwardManager.ForwardURL(ctx, creds.EndpointURL); pfErr == nil {
150+
if rewritten, pfErr := app.portForwardManager.ForwardURL(ctx, creds.EndpointURL); pfErr != nil {
151+
app.logger.Warn("dynamic port-forward failed for S3 endpoint, using original URL",
152+
"error", pfErr, "url", creds.EndpointURL)
153+
} else {
151154
creds.EndpointURL = rewritten
152155
}
153156
}

0 commit comments

Comments
 (0)