mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Fix trying to pipe a non stream on errors (no-changelog) (#5660)
This commit is contained in:
parent
edf6313fa5
commit
5790e5e719
|
@ -99,7 +99,7 @@ import type {
|
|||
} from 'axios';
|
||||
import axios from 'axios';
|
||||
import url, { URL, URLSearchParams } from 'url';
|
||||
import type { Readable } from 'stream';
|
||||
import { Readable } from 'stream';
|
||||
import { access as fsAccess } from 'fs/promises';
|
||||
import { createReadStream } from 'fs';
|
||||
|
||||
|
@ -687,7 +687,12 @@ async function proxyRequestToAxios(
|
|||
if (response) {
|
||||
Logger.debug('Request proxied to Axios failed', { status: response.status });
|
||||
let responseData = response.data;
|
||||
responseData = await binaryToBuffer(responseData);
|
||||
|
||||
if (Buffer.isBuffer(responseData) || responseData instanceof Readable) {
|
||||
responseData = await binaryToBuffer(responseData).then((buffer) =>
|
||||
buffer.toString('utf-8'),
|
||||
);
|
||||
}
|
||||
error.message = `${response.status as number} - ${JSON.stringify(responseData)}`;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue