BUG: HandleEnvVarDelete uses wrong route parameter name — env var deletion always 404s #104

Closed
opened 2026-02-20 12:27:58 +01:00 by clawbot · 0 comments
Collaborator

Severity: CRITICAL

File & Line

internal/handlers/app.go:919

Description

HandleEnvVarDelete reads chi.URLParam(request, "envID") but the route in routes.go:87 defines the parameter as {varID}:

// routes.go:87
r.Post("/apps/{id}/env-vars/{varID}/delete", s.handlers.HandleEnvVarDelete())

// app.go:919 — reads wrong param name
envVarIDStr := chi.URLParam(request, "envID")

Since "envID" is never set by the router, envVarIDStr is always empty, ParseInt fails, and the handler always returns 404. Environment variable deletion via the UI is completely broken.

Impact

Users cannot delete environment variables from apps. This is a core CRUD operation.

Suggested Fix

Change line 919 in app.go from:

envVarIDStr := chi.URLParam(request, "envID")

to:

envVarIDStr := chi.URLParam(request, "varID")
## Severity: CRITICAL ## File & Line `internal/handlers/app.go:919` ## Description `HandleEnvVarDelete` reads `chi.URLParam(request, "envID")` but the route in `routes.go:87` defines the parameter as `{varID}`: ```go // routes.go:87 r.Post("/apps/{id}/env-vars/{varID}/delete", s.handlers.HandleEnvVarDelete()) // app.go:919 — reads wrong param name envVarIDStr := chi.URLParam(request, "envID") ``` Since `"envID"` is never set by the router, `envVarIDStr` is always empty, `ParseInt` fails, and the handler **always returns 404**. Environment variable deletion via the UI is completely broken. ## Impact Users cannot delete environment variables from apps. This is a core CRUD operation. ## Suggested Fix Change line 919 in `app.go` from: ```go envVarIDStr := chi.URLParam(request, "envID") ``` to: ```go envVarIDStr := chi.URLParam(request, "varID") ```
clawbot added this to the 1.0 milestone 2026-02-20 12:27:58 +01:00
clawbot added the
bug
label 2026-02-20 12:27:58 +01:00
clawbot self-assigned this 2026-02-20 12:27:58 +01:00
sneak closed this issue 2026-02-20 13:47:12 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
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: sneak/upaas#104
No description provided.