XMLHttpRequest is not a constructor when using AWS javascript library

I just used the new feature Add JS Libraries and added the recommended Library AWS SDK for JavaScript.
Followed the code given in the examples (browser):

metrics: async () => {
		AWS.config.region = 'eu-west-3';
    AWS.config.credentials = new AWS.Credentials("SECRET","SECRET");
		var cw = new AWS.CloudWatch({apiVersion: '2010-08-01'});
		var params = {
			Dimensions: [
				{
					Name: 'LogGroupName', /* required */
				},
			],
			MetricName: 'IncomingLogEvents',
			Namespace: 'AWS/Logs'
		};

		cw.listMetrics(params, function(err, data) {
			if (err) {
				console.log("Error", err);
			} else {
				console.log("Metrics", JSON.stringify(data.Metrics));
			}
		});
	}

but got an error when executing directly from the EDIT window:

"message":"XMLHttpRequest is not a constructor"
"code":"NetworkingError"

any clue???

Can you share a screenshot or screen recording of this?

Sure! BTW, executed the code outside Appsmith in a single HTML page and it works correctly.

Thank you for sharing the recording and sorry for the delay.
Due to security reasons, XHR is disabled on the platform. Unfortunately, some methods on the AWS library may use XHR under the hood. As a workaround, you could try using the AWS APIs for methods that rely on XHR.