Fix build issue

This commit is contained in:
Jan Oberhauser 2021-10-12 22:20:51 -05:00
parent 8618415772
commit 1e34aca8bd
9 changed files with 19 additions and 13 deletions

View file

@ -236,11 +236,11 @@ async function parseRequestObject(requestObject: IDataObject) {
}
if (requestObject.uri !== undefined) {
axiosConfig.url = requestObject.uri as string;
axiosConfig.url = requestObject.uri?.toString() as string;
}
if (requestObject.url !== undefined) {
axiosConfig.url = requestObject.url as string;
axiosConfig.url = requestObject.url?.toString() as string;
}
if (requestObject.method !== undefined) {
@ -449,7 +449,7 @@ async function proxyRequestToAxios(
error.cause = errorData;
error.error = error.response?.data || errorData;
error.statusCode = error.response?.status;
error.options = config;
error.options = config || {};
// Remove not needed data and so also remove circular references
error.request = undefined;

View file

@ -3,6 +3,7 @@ import {
} from 'url';
import {
Request,
sign,
} from 'aws4';
@ -47,7 +48,7 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
const endpoint = new URL(getEndpointForService(service, credentials) + path);
// Sign AWS API request with the user credentials
const signOpts = { headers: headers || {}, host: endpoint.host, method, path, body };
const signOpts = { headers: headers || {}, host: endpoint.host, method, path, body } as Request;
sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim() });

View file

@ -45,9 +45,10 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
const endpoint = new URL(getEndpointForService(service, credentials) + path);
const options = sign({
// @ts-ignore
uri: endpoint,
service,
region: credentials.region,
region: credentials.region as string,
method,
path: '/',
headers: { ...headers },

View file

@ -1,5 +1,5 @@
import { URL } from 'url';
import { sign } from 'aws4';
import { Request, sign } from 'aws4';
import { OptionsWithUri } from 'request';
import { parseString as parseXml } from 'xml2js';
@ -38,7 +38,7 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
const endpoint = new URL(getEndpointForService(service, credentials) + path);
// Sign AWS API request with the user credentials
const signOpts = { headers: headers || {}, host: endpoint.host, method, path, body };
const signOpts = { headers: headers || {}, host: endpoint.host, method, path, body } as Request;
sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim() });

View file

@ -3,6 +3,7 @@ import {
} from 'url';
import {
Request,
sign,
} from 'aws4';
@ -44,7 +45,7 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
const endpoint = new URL(((credentials.rekognitionEndpoint as string || '').replace('{region}', credentials.region as string) || `https://${service}.${credentials.region}.amazonaws.com`) + path);
// Sign AWS API request with the user credentials
const signOpts = {headers: headers || {}, host: endpoint.host, method, path, body};
const signOpts = {headers: headers || {}, host: endpoint.host, method, path, body} as Request;
sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim()});

View file

@ -3,6 +3,7 @@ import {
} from 'url';
import {
Request,
sign,
} from 'aws4';
@ -38,7 +39,7 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
const endpoint = new URL(((credentials.s3Endpoint as string || '').replace('{region}', credentials.region as string) || `https://${service}.${credentials.region}.amazonaws.com`) + path);
// Sign AWS API request with the user credentials
const signOpts = {headers: headers || {}, host: endpoint.host, method, path: `${endpoint.pathname}?${queryToString(query).replace(/\+/g, '%2B')}`, body};
const signOpts = {headers: headers || {}, host: endpoint.host, method, path: `${endpoint.pathname}?${queryToString(query).replace(/\+/g, '%2B')}`, body} as Request;
sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim()});

View file

@ -3,6 +3,7 @@ import {
} from 'url';
import {
Request,
sign,
} from 'aws4';
@ -39,7 +40,7 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
// Sign AWS API request with the user credentials
const signOpts = { headers: headers || {}, host: endpoint.host, method, path, body };
const signOpts = { headers: headers || {}, host: endpoint.host, method, path, body } as Request;
sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim() });
const options: OptionsWithUri = {

View file

@ -3,6 +3,7 @@ import {
} from 'url';
import {
Request,
sign,
} from 'aws4';
@ -50,7 +51,7 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
const endpoint = new URL(getEndpointForService(service, credentials) + path);
// Sign AWS API request with the user credentials
const signOpts = { headers: headers || {}, host: endpoint.host, method, path, body };
const signOpts = { headers: headers || {}, host: endpoint.host, method, path, body } as Request;
sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim() });
@ -104,4 +105,3 @@ export async function awsApiRequestRESTAllItems(this: IHookFunctions | IExecuteF
return returnData;
}

View file

@ -1,4 +1,5 @@
import {
Request,
sign,
} from 'aws4';
@ -62,7 +63,7 @@ export async function s3ApiRequest(this: IHookFunctions | IExecuteFunctions | IL
path: `${path}?${queryToString(query).replace(/\+/g, '%2B')}`,
service: 's3',
body,
};
} as Request;
sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim() });