mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix: AWS credential testing issue (#4107)
This commit is contained in:
parent
680d255df5
commit
5130529066
|
@ -276,7 +276,7 @@ export class Aws implements ICredentialType {
|
||||||
let service = requestOptions.qs?.service as string;
|
let service = requestOptions.qs?.service as string;
|
||||||
let path = requestOptions.qs?.path;
|
let path = requestOptions.qs?.path;
|
||||||
const method = requestOptions.method;
|
const method = requestOptions.method;
|
||||||
const body = requestOptions.body;
|
let body = requestOptions.body;
|
||||||
let region = credentials.region;
|
let region = credentials.region;
|
||||||
const query = requestOptions.qs?.query as IDataObject;
|
const query = requestOptions.qs?.query as IDataObject;
|
||||||
if (!requestOptions.baseURL && !requestOptions.url) {
|
if (!requestOptions.baseURL && !requestOptions.url) {
|
||||||
|
@ -301,13 +301,13 @@ export class Aws implements ICredentialType {
|
||||||
endpoint = new URL(endpointString!.replace('{region}', credentials.region as string) + path);
|
endpoint = new URL(endpointString!.replace('{region}', credentials.region as string) + path);
|
||||||
} else {
|
} else {
|
||||||
// If no endpoint is set, we try to decompose the path and use the default endpoint
|
// If no endpoint is set, we try to decompose the path and use the default endpoint
|
||||||
const customUrl = new URL(requestOptions.baseURL! + requestOptions.url! + path);
|
const customUrl = new URL(`${requestOptions.baseURL!}${requestOptions.url}${path ?? ''}`);
|
||||||
service = customUrl.hostname.split('.')[0] as string;
|
service = customUrl.hostname.split('.')[0] as string;
|
||||||
region = customUrl.hostname.split('.')[1] as string;
|
region = customUrl.hostname.split('.')[1] as string;
|
||||||
if (service === 'sts') {
|
if (service === 'sts') {
|
||||||
try {
|
try {
|
||||||
customUrl.searchParams.set('Action', 'GetCallerIdentity');
|
customUrl.searchParams.set('Action', 'GetCallerIdentity');
|
||||||
customUrl.searchParams.append('Version', '2011-06-15');
|
customUrl.searchParams.set('Version', '2011-06-15');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
@ -321,6 +321,10 @@ export class Aws implements ICredentialType {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (body && Object.keys(body).length === 0) {
|
||||||
|
body = '';
|
||||||
|
}
|
||||||
|
|
||||||
path = endpoint.pathname + endpoint.search;
|
path = endpoint.pathname + endpoint.search;
|
||||||
|
|
||||||
const signOpts = {
|
const signOpts = {
|
||||||
|
|
Loading…
Reference in a new issue