File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -164,24 +164,25 @@ export const domainRouter = router({
164164 )
165165 . mutation ( async ( { input, ctx } ) => {
166166 try {
167- // Remove domain from deployment in DB first
168- await unpublishBuild (
169- { projectId : input . projectId , domain : input . domain } ,
170- ctx
171- ) ;
172-
173167 const { deploymentTrpc } = ctx . deployment ;
174168
175169 // Call deployment service to delete the worker for this domain
176170 const result = await deploymentTrpc . unpublish . mutate ( {
177171 domain : input . domain ,
178172 } ) ;
179173
180- // Allow NOT_IMPLEMENTED to proceed (for local dev without deployment service)
174+ // If failed (and not NOT_IMPLEMENTED), return error without touching DB
181175 if ( result . success === false && result . error !== "NOT_IMPLEMENTED" ) {
182176 return result ;
183177 }
184178
179+ // Remove domain from deployment in DB after successful worker deletion
180+ // Also proceed if NOT_IMPLEMENTED (for local dev without deployment service)
181+ await unpublishBuild (
182+ { projectId : input . projectId , domain : input . domain } ,
183+ ctx
184+ ) ;
185+
185186 return { success : true } as const ;
186187 } catch ( error ) {
187188 return createErrorResponse ( error ) ;
You can’t perform that action at this time.
0 commit comments