Skip to content

Commit

Permalink
Actually fix debug-zip issue, root cause was console history
Browse files Browse the repository at this point in the history
  • Loading branch information
miklschmidt committed Oct 1, 2024
1 parent 57edf75 commit bd9751c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pages/api/debug-zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const getDebugZipFiles = async () => {
const getConsoleHistory = async () => {
let consoleHistory = JSON.stringify({ result: 'error', msg: 'Failed to fetch console history' });
try {
consoleHistory = await (await fetch('http://localhost:7125/server/gcode_store?count=1000')).json();
consoleHistory = await (await fetch('http://localhost:7125/server/gcode_store?count=1000')).text();
} catch (e) {
getLogger().error(
e,
Expand Down Expand Up @@ -105,7 +105,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
res.setHeader('Content-Type', 'application/x-zip');
res.setHeader('Content-Disposition', `attachment; filename=ratos-debug.zip`);
getLogger().info(`Sending zip to client...`);
return zip
zip
.generateNodeStream({
type: 'nodebuffer',
streamFiles: true,
Expand All @@ -116,6 +116,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
.on('finish', () => {
res.end();
});
return;
} catch (e) {
getLogger().error(e instanceof Error ? e.message : 'Unknown error while generating debug zip');
return res.status(200).json({
Expand Down

0 comments on commit bd9751c

Please sign in to comment.