Skip to content

Commit e1f707f

Browse files
authored
fix: Use environment-specific log API endpoints for Cloud and OSS (#6539)
## Problem 401 authentication errors were persistently occurring when calling log-related APIs in the Cloud environment. ## Root Cause - Frontend was calling `/internal/logs/*` endpoints in all environments - Cloud backend provides public APIs at `/api/logs/*` (no authentication required) - OSS (open source) backend uses `/internal/logs/*` paths - This caused Cloud to call non-existent paths → resulting in 401 errors ## Solution Modified to use appropriate API endpoints based on environment using the `isCloud` flag: - Cloud environment: Use `/api/logs/*` - OSS environment: Use `/internal/logs/*` ## Changes - `getLogs()`: Added environment-specific URL branching - `getRawLogs()`: Added environment-specific URL branching - `subscribeLogs()`: Added environment-specific URL branching ## Testing - [x] Verified log functionality works correctly in local (OSS) environment - [x] Confirmed 401 errors are resolved in Cloud environment ## Related Issues This resolves the 401 errors tracked in Sentry for log API endpoints. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6539-fix-Use-environment-specific-log-API-endpoints-for-Cloud-and-OSS-29f6d73d365081da9e77f8b55556ca81) by [Unito](https://www.unito.io)
1 parent fddebd4 commit e1f707f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/scripts/api.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,15 +1135,22 @@ export class ComfyApi extends EventTarget {
11351135
}
11361136

11371137
async getLogs(): Promise<string> {
1138-
return (await axios.get(this.internalURL('/logs'))).data
1138+
const url = isCloud ? this.apiURL('/logs') : this.internalURL('/logs')
1139+
return (await axios.get(url)).data
11391140
}
11401141

11411142
async getRawLogs(): Promise<LogsRawResponse> {
1142-
return (await axios.get(this.internalURL('/logs/raw'))).data
1143+
const url = isCloud
1144+
? this.apiURL('/logs/raw')
1145+
: this.internalURL('/logs/raw')
1146+
return (await axios.get(url)).data
11431147
}
11441148

11451149
async subscribeLogs(enabled: boolean): Promise<void> {
1146-
return await axios.patch(this.internalURL('/logs/subscribe'), {
1150+
const url = isCloud
1151+
? this.apiURL('/logs/subscribe')
1152+
: this.internalURL('/logs/subscribe')
1153+
return await axios.patch(url, {
11471154
enabled,
11481155
clientId: this.clientId
11491156
})

0 commit comments

Comments
 (0)