mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
fix(AwsS3 Node): Use location constrain (#8654)
This commit is contained in:
parent
8e9d3106a5
commit
c73aeeec3d
|
@ -284,7 +284,13 @@ export class Aws implements ICredentialType {
|
||||||
let path = requestOptions.qs?.path;
|
let path = requestOptions.qs?.path;
|
||||||
const method = requestOptions.method;
|
const method = requestOptions.method;
|
||||||
let body = requestOptions.body;
|
let body = requestOptions.body;
|
||||||
|
|
||||||
let region = credentials.region;
|
let region = credentials.region;
|
||||||
|
if (requestOptions.qs?._region) {
|
||||||
|
region = requestOptions.qs._region as string;
|
||||||
|
delete requestOptions.qs._region;
|
||||||
|
}
|
||||||
|
|
||||||
let query = requestOptions.qs?.query as IDataObject;
|
let query = requestOptions.qs?.query as IDataObject;
|
||||||
// ! Workaround as we still use the IRequestOptions interface which uses uri instead of url
|
// ! Workaround as we still use the IRequestOptions interface which uses uri instead of url
|
||||||
// ! To change when we replace the interface with IHttpRequestOptions
|
// ! To change when we replace the interface with IHttpRequestOptions
|
||||||
|
@ -324,10 +330,10 @@ export class Aws implements ICredentialType {
|
||||||
} else if (service === 'sqs' && credentials.sqsEndpoint) {
|
} else if (service === 'sqs' && credentials.sqsEndpoint) {
|
||||||
endpointString = credentials.sqsEndpoint as string;
|
endpointString = credentials.sqsEndpoint as string;
|
||||||
} else if (service) {
|
} else if (service) {
|
||||||
endpointString = `https://${service}.${credentials.region}.amazonaws.com`;
|
endpointString = `https://${service}.${region}.amazonaws.com`;
|
||||||
}
|
}
|
||||||
endpoint = new URL(
|
endpoint = new URL(
|
||||||
endpointString!.replace('{region}', credentials.region as string) + (path as string),
|
endpointString!.replace('{region}', region as string) + (path as string),
|
||||||
);
|
);
|
||||||
} 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
|
||||||
|
|
|
@ -29,12 +29,14 @@ export async function awsApiRequest(
|
||||||
service,
|
service,
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
|
_region,
|
||||||
},
|
},
|
||||||
method,
|
method,
|
||||||
body,
|
body,
|
||||||
url: '',
|
url: '',
|
||||||
headers,
|
headers,
|
||||||
} as IHttpRequestOptions;
|
} as IHttpRequestOptions;
|
||||||
|
|
||||||
if (Object.keys(option).length !== 0) {
|
if (Object.keys(option).length !== 0) {
|
||||||
Object.assign(requestOptions, option);
|
Object.assign(requestOptions, option);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue