Summary
DELETE /api/v1/teams/:teamId/git/tokens/:tokenId deletes a token even when git-repository pipeline stages use it. The foreign key is ON DELETE SET NULL, so the stages are kept with no token and every later push or pull fails with a message that does not say why.
Steps to reproduce
- Create a git token and a pipeline stage that uses it (
PUT /api/v1/pipelines/:id/stages/:stageId with gitTokenId).
- Delete the token. The response is 200.
- Fetch the stage:
gitRepo.gitTokenId is now "". Trigger a deploy or pull on the stage.
Expected
Either the delete is refused with a 409 naming the pipelines that use the token, or the stage is marked clearly as having no token, and the push or pull error says the git token is missing.
Actual
PipelineStageGitRepo.deploy and .pull read gitToken.token from a null token inside their try block, so the stage ends in status error with the message Cannot read properties of null (reading 'token'). The UI shows that text.
References
forge/ee/routes/gitops/index.js:65-81 (delete route)
forge/db/migrations/20250408-02-EE-add-pipeline-stage-git-repo.js:45-50 (SET NULL)
forge/ee/db/models/PipelineStageGitRepo.js:95,104,147,159
forge/ee/db/views/PipelineStage.js:70 (encodeHashid(null) yields "")
Summary
DELETE /api/v1/teams/:teamId/git/tokens/:tokenIddeletes a token even when git-repository pipeline stages use it. The foreign key isON DELETE SET NULL, so the stages are kept with no token and every later push or pull fails with a message that does not say why.Steps to reproduce
PUT /api/v1/pipelines/:id/stages/:stageIdwithgitTokenId).gitRepo.gitTokenIdis now"". Trigger a deploy or pull on the stage.Expected
Either the delete is refused with a 409 naming the pipelines that use the token, or the stage is marked clearly as having no token, and the push or pull error says the git token is missing.
Actual
PipelineStageGitRepo.deployand.pullreadgitToken.tokenfrom a null token inside their try block, so the stage ends in statuserrorwith the messageCannot read properties of null (reading 'token'). The UI shows that text.References
forge/ee/routes/gitops/index.js:65-81(delete route)forge/db/migrations/20250408-02-EE-add-pipeline-stage-git-repo.js:45-50(SET NULL)forge/ee/db/models/PipelineStageGitRepo.js:95,104,147,159forge/ee/db/views/PipelineStage.js:70(encodeHashid(null)yields"")