You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "abstrask (via GitHub)" <gi...@apache.org> on 2026/10/16 10:34:30 UTC

[PR] fix(server): return 502 instead of passing through upstream 401 [devlake]

abstrask opened a new pull request, #9231:
URL: https://github.com/apache/devlake/pull/9231

   ### Summary
   `shared.ApiOutputError` (and its siblings) and the plugin handler wrapper in `router.go` pass an upstream service's 401 through as DevLake's own HTTP 401. Config UI treats any 401 as an expired DevLake session and redirects to `/login`. For example, a GitHub App token request rejected by GitHub during `POST /blueprints/:id/trigger` sends the user to the login page (which, with `AUTH_ENABLED` unset, shows "Single Sign-On is not configured").
   
   DevLake's own session and API key 401s are written directly by the auth middleware and never go through these paths, so this maps an upstream 401 to 502 Bad Gateway there. All other status codes are unchanged.
   
   With that in place, the plugin connection test exemption added to `config-ui/src/utils/request.ts` in #9159 is no longer needed, so the second commit removes it.
   
   Note: this changes the API status code from 401 to 502 for any endpoint that surfaces an upstream 401, including plugin connection tests.
   
   ### Does this close any open issues?
   Part of #9220 (the 401 passthrough part only).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(server): return 502 instead of passing through upstream 401 [devlake]

Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh merged PR #9231:
URL: https://github.com/apache/devlake/pull/9231


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(server): return 502 instead of passing through upstream 401 [devlake]

Posted by "abstrask (via GitHub)" <gi...@apache.org>.
abstrask commented on PR #9231:
URL: https://github.com/apache/devlake/pull/9231#issuecomment-6213586282

   If you'd prefer a smaller UI-only change instead, following the approach from #9159, this would also fix the trigger case:
   
   ```diff
   +// Blueprint triggers can return 401 from a remote (e.g. GitHub App token request), not a DevLake session expiry.
   +const isBlueprintTrigger = (url?: string) => !!url && /\/blueprints\/[^/]+\/trigger\/?$/.test(url);
   @@
   -      !isPluginConnectionTest(requestUrl)
   +      !isPluginConnectionTest(requestUrl) &&
   +      !isBlueprintTrigger(requestUrl)
   ```
   
   It only covers that one endpoint, though; other endpoints surfacing an upstream 401 would still redirect to `/login`. Happy to switch to this if you prefer.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org