Summary
netlify logs --source deploy fails with 404 Not Found because the CLI sends the historical deploy-log request to a URL containing a duplicated /api/v1 prefix.
This reproduces on two independently linked Netlify sites.
Environment
- Netlify CLI:
netlify-cli/26.2.0 darwin-arm64 node-v24.18.0
- Node.js:
v24.18.0
- OS: macOS 26.5.2, arm64
Minimal reproduction
-
Link a local directory to a Netlify site that has at least one completed deploy.
-
Run:
DEBUG=1 netlify logs --source deploy --since 1h
-
Observe the request URL and error:
[debug] → GET https://api.netlify.com/api/v1/api/v1/deploys/<deploy-id>/log
[debug] ← 404 Not Found
Error: Failed to fetch deploy logs: 404 Not Found
The same result occurs without DEBUG=1; the debug flag only exposes the generated URL.
Expected behavior
The command should return historical deploy logs for the selected/latest ready deploy, as described by netlify logs --help and the CLI command documentation.
Actual behavior
The command always fails with:
Error: Failed to fetch deploy logs: 404 Not Found
Suspected cause
logsCommand passes client.basePath as apiBase:
const apiBase = client.basePath
In a normal authenticated CLI session, this value is already:
https://api.netlify.com/api/v1
fetchDeployHistoricalLogs then appends another /api/v1:
debugFetch(`${apiBase}/api/v1/deploys/${encodeURIComponent(deployId)}/log`, ...)
This produces:
https://api.netlify.com/api/v1/api/v1/deploys/<deploy-id>/log
The likely path-construction fix is to append only /deploys/<deploy-id>/log when apiBase is client.basePath.
Additional observation
I also tested the presumed corrected URL directly with the same authenticated token and deploy IDs:
GET https://api.netlify.com/api/v1/deploys/<deploy-id>/log
That request also returned 404 Not Found on both sites. In addition, the public Netlify OpenAPI specification does not appear to expose a GET endpoint for historical deploy logs (it documents POST /builds/{build_id}/log, but not a deploy-log retrieval endpoint).
So there may be two separate issues to verify:
- The duplicated
/api/v1 in the CLI URL construction.
- Whether
/deploys/{deploy_id}/log is the correct and currently available backend endpoint for historical deploy-log retrieval.
Regression/testing note
The historical deploy-log path was added as part of the unified logs command. The current integration tests appear to cover migration from the deprecated logs:deploy command, but not an authenticated historical deploy-log HTTP request, which may explain why the malformed URL was not caught.
netlify logs --source deploy --follow takes the WebSocket path instead and does not hit this HTTP 404, although it naturally requires an active build.
Summary
netlify logs --source deployfails with404 Not Foundbecause the CLI sends the historical deploy-log request to a URL containing a duplicated/api/v1prefix.This reproduces on two independently linked Netlify sites.
Environment
netlify-cli/26.2.0 darwin-arm64 node-v24.18.0v24.18.0Minimal reproduction
Link a local directory to a Netlify site that has at least one completed deploy.
Run:
Observe the request URL and error:
The same result occurs without
DEBUG=1; the debug flag only exposes the generated URL.Expected behavior
The command should return historical deploy logs for the selected/latest ready deploy, as described by
netlify logs --helpand the CLI command documentation.Actual behavior
The command always fails with:
Suspected cause
logsCommandpassesclient.basePathasapiBase:In a normal authenticated CLI session, this value is already:
fetchDeployHistoricalLogsthen appends another/api/v1:This produces:
The likely path-construction fix is to append only
/deploys/<deploy-id>/logwhenapiBaseisclient.basePath.Additional observation
I also tested the presumed corrected URL directly with the same authenticated token and deploy IDs:
That request also returned
404 Not Foundon both sites. In addition, the public Netlify OpenAPI specification does not appear to expose a GET endpoint for historical deploy logs (it documentsPOST /builds/{build_id}/log, but not a deploy-log retrieval endpoint).So there may be two separate issues to verify:
/api/v1in the CLI URL construction./deploys/{deploy_id}/logis the correct and currently available backend endpoint for historical deploy-log retrieval.Regression/testing note
The historical deploy-log path was added as part of the unified
logscommand. The current integration tests appear to cover migration from the deprecatedlogs:deploycommand, but not an authenticated historical deploy-log HTTP request, which may explain why the malformed URL was not caught.netlify logs --source deploy --followtakes the WebSocket path instead and does not hit this HTTP 404, although it naturally requires an active build.