How to add "aws-sdk" into postman local environment

Hey Community,

I had a pre-request script which needs to call “aws-sdk”, as below:

const AWS = require(‘aws-sdk’);

While it reports error: “can’t find ‘aws-sdk’”

I tried to add its cdn as a variable in environment, pls see below two pics

Then added below snippet into pre-request script:

const AWS =pm.environment.get(“aws-sdk”);
(new Function(AWS))();

But it still shows error: SyntaxError: Unexpected token ‘}’

So any suggestions to use aws-sdk in postman pre-request script

Have a look at the following Collection which shows a few methods for consuming external libraries.

It would appear that you should be using the “Pulling library from a CDN” method using the JavaScript EVAL functionality.

It only really works if the library is fully contained in the CDN.

A lot of these libraries have dependencies on other libraries, and they won’t work.

Hello @lucas-ccia , did this solution work for you ?
we also had similar requirement to handle sqs call AWS.SQS()
but its not working