Social cloud hosting
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: redirect console output to stderr in executor

Bundle console.log calls were mixing with JSON response output,
causing parsing failures. Now all console methods write to stderr
while only the final JSON response goes to stdout.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+18 -1
+1
.gitignore
··· 13 13 # Build artifacts 14 14 dist/ 15 15 result 16 + at-rund-linux
+17 -1
nix/runtimes/deno/executor.ts
··· 55 55 Deno.env.set(key, value); 56 56 } 57 57 58 + // Redirect console methods to stderr so bundle logs don't corrupt JSON output 59 + const encoder = new TextEncoder(); 60 + 61 + const writeToStderr = (...args: unknown[]) => { 62 + const msg = args.map(a => typeof a === 'string' ? a : JSON.stringify(a)).join(' ') + '\n'; 63 + Deno.stderr.writeSync(encoder.encode(msg)); 64 + }; 65 + 66 + console.log = writeToStderr; 67 + console.info = writeToStderr; 68 + console.warn = writeToStderr; 69 + console.error = writeToStderr; 70 + console.debug = writeToStderr; 71 + 58 72 try { 59 73 // Import the bundle 60 74 const bundleUrl = `file://${req.codePath}`; ··· 149 163 } 150 164 151 165 function output(resp: ExecResponse) { 152 - console.log(JSON.stringify(resp)); 166 + // Write directly to stdout to avoid any console redirects 167 + const encoder = new TextEncoder(); 168 + Deno.stdout.writeSync(encoder.encode(JSON.stringify(resp) + '\n')); 153 169 } 154 170 155 171 function outputError(error: string) {